All About Methods

One thing people often forget is that those query operator implementations are simply found using the typical C# method resolution rules. In particular, instance methods are considered before any extension methods are. It just so happens that the most typical LINQ implementations, such as LINQ to Objects and the IQueryable query providers, use extension methods on interfaces to define the query operators once and for all for all targeted data sources.

In short, you should realize that keywords such as where, select, orderby, groupby, join, and let all translate into “chains” of method calls, typically passing in lambda expressions for functional arguments such as filters, projections, key selectors, and so on. Once a query has ...

Get C# 4.0 Unleashed now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.