|
Listing 13-29 extracted from chapter
Generics
Listing 13-28< > Listing 13-30
This listing can be compiled with the command line: csc.exe /target:library Example_13_29.cs Errors: 0 Warnings: 0
Example_13_29.cs
class C {
public int Fct<U>(U u) where U : class, System.IComparable<U> ,new(){
if ( u == null )
return 0;
U unew = new U();
return u.CompareTo( unew );
}
}
Copyright Patrick Smacchia 2006 2007
|