views:

29

answers:

1

I have two Classes :

class Customer
{
    public string Fullname { get; set; }
    public string Lastname { get; set; }
    public int Age { get; set; }
}

and

class CustomerDTO
{
    public string Fullname { get; set; }
    public string Lastname { get; set; }
    public int Age { get; set; }
}

now i have an expressiontree Expression<Func<Customer, bool>> expression Passed between layers , can i convert it to Expression<Func<CustomerDTO, bool>> expression to be able to use it since it would give compile time error!

thanks in advance

A: 

nevermind i made it

Expression<Func<Customer, bool>> expression = v => v.Fullname == "Johm";
         var par = Expression.Parameter(typeof(CustomerDTO));
         Expression<Func<CustomerDTO, bool>> ex = (Expression<Func<CustomerDTO, bool>>)Expression.Lambda(expression.Body, par);
Stacker
Nice, now just accept your own answer so it gets removed from the queue. :)
Kirk Woll