Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

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.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 699613
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T03:24:20+00:00 2026-05-14T03:24:20+00:00

My understanding of expression trees is : Expression trees are in-memory representation of expression-like

  • 0

My understanding of expression trees is :

Expression trees are in-memory representation of expression-like arithmetic or boolean expressions. The expressions are stored into a parsed tree, so we can easily translate into any other language.

Linq-to-SQL uses expression trees. Normally in a Linq-to-SQL query the compiler translates it into parsed expression trees. These are passed to SQL Server as T-SQL Statements. The SQL server executes the T-SQL query and sends the result back. This is why when you execute Linq-to-SQL you get IQueryable<T> not IEnumerable<T>; because IQueryable contains

public IQueryable : IEnumerable
{
   Type Element {get;}
   Expression Expression {get;}
   IQueryableProvider Provider {get;}
}

Questions :

  1. Microsoft uses Expression trees in LINQ-to-SQL. What are the different ways I can use expression trees to boost my code?

  2. Apart from LINQ-to-SQL, Linq to amazon, who uses expression trees in their applications?

  3. Linq-to-Object returns IEnumerable, Linq-to-SQL returns IQueryable, What does LINQ-to-XML return?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T03:24:21+00:00Added an answer on May 14, 2026 at 3:24 am

    Expression trees offer a way to inspect some piece of code before it is actually compiled, at runtime.

    You can do exactly two things with an expression tree:

    • Compile it into a delegate, using Expression.Compile, or
    • Visit the tree nodes and generate something else from it (i.e. a SQL statement).

    Expression trees are cool, but the odds of them actually having any direct usefulness for a typical website or enterprise app are remote. You would only use them when you (a) want to generate a different type of code from C# source at runtime, or (b) want to use Reflection but provide some measure of compile-time safety.

    If you are working on reusable libraries – DI frameworks, AOP frameworks, MVC/MVP/MVVM frameworks, ORM frameworks, and so on, or trying to extend one of these frameworks (including Linq-to-XYZ), then you will likely find a use for expression trees (such as the Linq to SQL batch update extension), although it’s hard to discuss specific examples because it would depend entirely on the design of such a framework.

    If you’re not building these sorts of tools then expression trees aren’t much more than a curiosity. Great to learn about of course – but don’t be disappointed if you don’t find too many practical uses for them.

    A few examples of libraries that use expression trees:

    • Ninject
    • Autofac
    • The ASP.NET MVC framework itself
    • NHibernate Linq (and of course Linq to SQL/EF/etc.)
    • The .NET 4 Dynamic Language Runtime

    …That should give you an idea of the kind of projects that make serious use of expression trees. So if you’re building your own runtime environment or MVC, you definitely want to learn everything you can. 😉

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Expression trees represent code in a tree-like data structure, where each node is an
I am currently looking into the problem of regular expressions which can end up
I have a little problem understanding what an expression like {{ something.render() | safe
My understanding is that Java's implementation of regular expressions is based on Perl's. However,
So I'm new to regular expressions and having difficulty understanding them. To get my
Understanding that I should probably just dig into the source to come up with
To my understanding, you can add files directly from MacVim with the NERDTree plugin.
A template argument can be a constant expression (§C.5), the address of an object
In my Java book, it says that an expression is a statement that can
It is my understanding that expression templates will break on ranged based for in

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.