Solved

What are "Expression Trees" in C# ?

Posted on 2011-09-08
3
418 Views
Last Modified: 2012-05-12
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
Comment
Question by:milani_lucie
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 4

Expert Comment

by:asp_net2
ID: 36506521
Hi,

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

http://msdn.microsoft.com/en-us/library/bb397951.aspx
0
 
LVL 30

Accepted Solution

by:
anarki_jimbel earned 250 total points
ID: 36507226
Try also the following link - it explains quite well:

http://marlongrech.wordpress.com/2008/01/08/working-with-expression-trees-part-1/
0
 
LVL 8

Assisted Solution

by:jagrut_patel
jagrut_patel earned 250 total points
ID: 36508182
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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
linq, c# 8 52
.NET Enums [Flags] & Bitwise Design Question 6 53
aspx ascx, c# 7 44
What!!!??? 5 61
Summary: Persistence is the capability of an application to store the state of objects and recover it when necessary. This article compares the two common types of serialization in aspects of data access, readability, and runtime cost. A ready-to…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…

751 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question