Thursday, 19 April 2007

How to use generic ForEach method

You can see in the example how you can use generic ForEach method.

DateTime latestDate = DateTime.MinValue;
string version = string.Empty;

list.ForEach(delegate(Version v)
{
if (v.CreatedAt > latestDate)
{
latestDate = v.CreatedAt;
version = v.Number;
});

No comments: