Skip to main content

Posts

Showing posts with the label LINQ Queries Using Method and Query Syntax

LINQ Queries Examples Using Query Method and Query Syntax

Basically, the LINQ queries using query syntax and method syntax. The method syntax called Lambda Expressions. The LINQ query syntax is close to native language and it is simple and easy to read. The method syntax is powerful but it is shorter and suitable tool. They compile the same and both are equivalent. Personally, I prefer to lambda extensions for most code writing. I am only using the statements if I am doing LINQ to SQL otherwise I am trying to emulate SQL. I find that the lambda methods flow better with code whereas the statements are visually distracting. You can see the LINQ Query in the below pic, So, here I am trying to explain gather T-SQL queries along with their equivalent LINQ queries in the both method and query syntax. EmpEntites empEnt = new EmpEntites();   //This is entities objects. In these entities objects, we have a table “ tbl_Employee ” and I am trying to explain T-SQL queries along with their equivalent LINQ queri...