15 oct 2007

Action delegate - Generics

For example, here is using the Action delegate to trace every value in a given array:[C#]

string[] cities = {"New York","San Francisico","London"};

Action trace = delegate(string text) { Trace.WriteLine(text); };

Array.ForEach(cities,trace);

PrabhakarThallapalli: FAQ in Generics:

1 comentario:

Ripier dijo...

Excelent example!! Very interesting, but...why you use foreing cities in your example?? Don't you love your country? XD

FeedCount

analytics

 
sfrede