A LINQ to SQL query is not executed inside your C# program. Instead, it is translated into SQL query, sent across a wire, and executed on a database server.
In other words, the following code is never actually executed inside your program:
var query = from c in db.Customers
where c.City == "Nantes"
select new { c.City, c.CompanyName };
It is first translated into the following SQL statement and then executed on a server:
SELECT [t0].[City], [t0].[CompanyName]
FROM [dbo].[Customers] AS [t0]
WHERE [t0].[City] = @p0
It is obviously going to be much easier to translate a data structure such as an expression tree into SQL than it is to translate raw IL or executable code into SQL.
Expression trees are also used in the dynamic language runtime (DLR) to provide interoperability between dynamic languages and the .NET Framework and to enable compiler writers to emit expression trees instead of Microsoft intermediate language (MSIL).
For better understanding refer following link:
Expression Tree[
^]