Thursday, January 2, 2014

words that c# compiler add to LINQ

for example:
in this case
SortedList<int, string> sl = new SortedList<int, string>() { { 4, "beatrice" }, { 2, "herby" } };

this 
Console.WriteLine(sl.FirstOrDefault((KeyValuePair<int, string> p) => {return p.Key == 4; }).Value);

is equivelant to this:

Console.WriteLine(sl.FirstOrDefault(p => p.Key == 4).Value);

No comments:

Post a Comment