Search

LINQ to Lambda

As we know the LINQ is a language integrated query introduced in visual studio 2008 which offered an compact, and intelligible syntax for manipulating data & objects. Also Lambda expressions are introduced which is like an anonymous function that can be used to write local functions, delegates and expression tree. The below are few examples as how to modify the LINQ expression to Lambda.

Filtering

//Linq
    var column = from o in Orders
                 where o.CustomersId = 45
                 select o;
/* can be converted to Lambda as */
//Lambda
    var column = Orders.Where(o => o.CustomersId == 45);