O'Reilly logo

Fluent Entity Framework by Rebecca M. Riordan

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

Method syntax

The LINQ queries you’ve seen and written so far use QUERY SYNTAX, which expresses your query as a series of clauses (from, where, etc.) in a statement. LINQ also provides another way of expressing queries, called METHOD SYNTAX, which, as you might expect, expresses the query using method calls rather than statements.

Instead of expressing a query as a statement:

Image

You can express it as a method call:

Image

Query syntax is the recommended format (does anybody actually enjoy writing lambdas?), but some LINQ methods, like Count() and Average() ...

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