Can you Explain the terms Expression Tree… Expression in Linq ?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
I’d recommend reading up on Expression Trees on MSDN.
They’re most commonly used with LINQ when using
IQueryable<T>, ie: LINQ to Sql or Entity Framework and similar. The lambda expression you pass to a LINQ query gets turned into an expression tree, which is a way to “represent code in a tree-like data structure”.This allows the provider in question to turn this into an actual SQL database call, since it can parse the expression tree and translate it into something the database understands natively.
That being said, this can be used in other places, as well. Any time you need to represent “code” and build it up, you can use expression trees. For example, this is often used to implement INotifyPropertyChanged without requiring strings to be passed.