|
Listing 14-21 extracted from chapter Unsafe code, exceptions, anonymous methods, iterators
Listing 14-20< > Listing 14-22
This listing can be compiled with the command line: csc.exe /target:exe Example_14_21.cs Errors: 0 Warnings: 0
Example_14_21.cs
class Foo<T> {
delegate void DelegateType( T t );
internal void Fct( T t ) {
DelegateType delegateInstance = delegate( T arg ){
System.Console.WriteLine( "Hello arg:{0}" , arg.ToString() ); };
delegateInstance( t );
}
}
class Program {
static void Main() {
Foo<double> inst = new Foo <double>();
inst.Fct(5.5);
}
}
Copyright Patrick Smacchia 2006 2007
|