Wednesday, March 22, 2006

Thinking Ruby in C# 2.0 ?

foreach(string chosenstring in myList.FindAll(new Predicate<string>(delegate(string s)
{
return s.Length>10;
})))
{
Console.WriteLine("the following string is long: " +chosenstring);
}


The preceding code will run through a list containing strings and output the strings longer than 10 words.

read it and weep

No comments: