O'Reilly logo

WCF 4.0 Multi-tier Services Development with LINQ to Entities 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

Built-in LINQ extension methods and method syntax

.NET framework 3.5 defines lots of extension methods in the namespace, System.Linq, including Where, Select, SelectMany, OrderBy, OrderByDescending, ThenBy, ThenByDescending, GroupBy, Join, and GroupJoin.

We can use these extension methods just as we would use our own extension methods. For example, we can use the Where extension method to get all vegetables from the Products list, like this:

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

This will give us the same result as veges1 through veges5.

As a matter of fact the definition of the built-in LINQ extension method, Where, is just like our extension method, Get, but in a different namespace:

namespace System.Linq { public ...

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