Solved

What are "Expression Trees" in C# ?

Posted on 2011-09-08
3
414 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
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 29

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Introduction This article series is supposed to shed some light on the use of IDisposable and objects that inherit from it. In essence, a more apt title for this article would be: using (IDisposable) {}. I’m just not sure how many people would ge…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…
Hi friends,  in this video  I'll show you how new windows 10 user can learn the using of windows 10. Thank you.

867 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now