How to merge two Expression<Func<T, object>>

Viewed 216

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?

0 Answers
Related