[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 425
  • Last Modified:

What are "Expression Trees" in C# ?

Hi,

Can you please explain to me:

What are "Expression Trees" in C# ?

Please provide me a simple example on it and explain to me in simple terms so that i can understand better the basics.

Thanks
0
milani_lucie
Asked:
milani_lucie
2 Solutions
 
asp_net2Commented:
Hi,

URL explains Expression Trees with examples in C# and VB.

http://msdn.microsoft.com/en-us/library/bb397951.aspx
0
 
anarki_jimbelCommented:
Try also the following link - it explains quite well:

http://marlongrech.wordpress.com/2008/01/08/working-with-expression-trees-part-1/
0
 
jagrut_patelCommented:
Start from Expression Tree Basics.

+ Expression Tree is a data-structure to represent expression in form of a structured tree that can be parsed and analyzed. Imagine how compiler can evaluate any mathematical expression like (a+b)-c. How can it know that it has to first add (a) to (b) and then subtract (c) from the result. Such parsin is done by breaking down the expression as

                                                    -  
                                           +             c
                                         a   b

+ LINQ is driven by Expression trees. e.g. A LINQ query expression (LINQ2SQL, or LINQ2Entities) has to converted into a SQL statement and executed on a DB server. By converting a LINQ query into Expression tree, LINQ can traverse the nodes and convert them into SQL statements that can be passed to DB server for execution.



0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now