Solved

What are "Expression Trees" in C# ?

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

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

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…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

744 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

11 Experts available now in Live!

Get 1:1 Help Now