Expression Tree : C#

Posted by nettguy on Stack Overflow See other posts from Stack Overflow or by nettguy
Published on 2010-03-28T16:40:58Z Indexed on 2010/03/28 16:43 UTC
Read the original article Hit count: 309

Filed under:
|
|

My understanding of expression tree is :

Expression trees are in-memory representation of expression like arithmetic or boolean expression.The expressions are stored into the parsed tree.so we can easily transalate into any other language.

Linq to SQL uses expression tree.Normally when our LINQ to SQL query compiler translates it to parsed expression trees.These are passed to Sql Server as T-SQL Statements.The Sql server executes the T-SQL query and sends down the result back.That is why when you execute LINQ to SQL you gets IQueryable<T> not IEnumetrable<T>.Because IQuerybale contains

public IQueryable:IEnumerable
{

   Type Element {get;}
   Expression Expression {get;}
   IQueryaleProvider Provider {get;}
}

Questions :

  1. Microsoft uses Expression trees to play with LINQ-to-Sql.What are the different ways can i use expression trees to boost my code.

  2. Apart from LINQ to SQL,Linq to amazon ,who used expression trees in their applications?

  3. Linq to Object return IEnumerable,Linq to SQL return IQueryable ,What does LINQ to XML return?

© Stack Overflow or respective owner

Related posts about ASP.NET

Related posts about c#