I have a class:
public class Person {
public virtual string Id { get; set; }
public virtual string Name { get; set; }
public virtual int Age { get; set; }
public virtual DateTime UpdateTime { get; set; }
}
And I have two Expression<Func<T, object>>
objects:
Expression<Func<Person, object>> exp1 = t => t.UpdateTime
Expression<Func<Person, object>> exp2 = t => new {t.Age, t.Name}
And now I need to merge them to
Expression<Func<Person, object>> exp1 = t => new {t.UpdateTime, t.Age, t.Name}
Is this possible? If so, how?
AndAlso
orOrElse
because the predicate returns bool. OP is asking how to merge two objects. So how is this relevant here?T
in the example is not valid (or rather does not contain enough information) since an arbitraryT
can't possibly have the specified properties. Can you show perhaps a full method or class declaration? IsT
constrained to something or was it perhaps a bad example andT
is really meant to represent a specific claas? Can you show that definition?Expression
?