O'Reilly logo

WCF 4.5 Multi-Layer Services Development with Entity Framework by Mike Liu

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

LINQ query syntax and query expression

With built-in LINQ extension methods and lambda expressions, Visual Studio allows us to write SQL-like statements in C# when invoking these methods. The syntax of these statements is called LINQ query syntax and the expression in query syntax is called a query expression.

For example, we can change the following statement:

var veges6 = products.Where(p => p.ProductName.Contains("vegetable"));

To the following query statement by using the LINQ query syntax:

var veges7 = from p in products
             where p.ProductName.Contains("vegetable")
             select p;

In the above C# statement, we can directly use the SQL keywords select, from, and where to "query" an in-memory collection list. In addition to the in-memory collection lists, ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required