Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

What are "Expression Trees" in C# ?

Posted on 2011-09-08
3
Medium Priority
?
423 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 30

Accepted Solution

by:
anarki_jimbel earned 1000 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 1000 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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Introduction Although it is an old technology, serial ports are still being used by many hardware manufacturers. If you develop applications in C#, Microsoft .NET framework has SerialPort class to communicate with the serial ports.  I needed to…
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…
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 anti-spam), the admin…
Screencast - Getting to Know the Pipeline
Suggested Courses

773 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