Friday, October 30, 2009

Lambda expression

To implement a custom filtering or sorting of a LINQ query, simply implement LINQ lambda expression.


var mainLinqQuery = from someVar1 in someCollection select someVar1;


some while later after typing more lines of code.


var filteredLinqQuery = mainLinqQuery.Where(someVar2 => someVar2.someProperty == itemToFilterBy);


The result of the filtered LINQ query, filteredLinqQuery will be the specific result that we require.

No comments:

Post a Comment