Code to apply expression tree directly to List

Posted by Gamma Vega on Stack Overflow See other posts from Stack Overflow or by Gamma Vega
Published on 2010-04-07T02:24:02Z Indexed on 2010/04/07 2:33 UTC
Read the original article Hit count: 397

Filed under:
|
|
|

Is there a method call in Linq that will apply a expression tree directly on a List<V>? For instance, if I have a expression tree that is built on Order type, and i have a collection of List<Order> items on which i need to apply this expression.

I am looking something similar to:

class OrderListStore : IQueryable<V>,
    <other interfaces required to implement custom linq provider>
{
    List<Order> orders;

    public Expression Expression
    {
        get { return Expression.Constant(this); }
    }

    IEnumerator<V> IEnumerable<V>.GetEnumerator()
    {
        //Here I need to have a method that will take the existing expression
        //and directly apply on list
        something like this .. Expression.Translate(orders);
    }

}

Any help in this regard is highly appreciated.

© Stack Overflow or respective owner

Related posts about .NET

Related posts about c#