Expression Trees

image As mentioned before, lambda expressions were introduced as part of the C# 3.0 LINQ wave of languages features, but not just as a way to simplify the syntax used to create anonymous functions. One of the key promises of LINQ is the capability to express a query using the same language-integrated syntax no matter where it executes. This means the query can target in-memory object graphs (with LINQ to Objects) as well as remote data sources such as SQL databases (with LINQ to SQL or the Entity Framework).

However, databases like SQL Server cannot be approached with IL code representing the query to be executed (ignoring the concept ...

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.