Linq - Merging property accessor expressions
I have a MemberExpression
that con开发者_运维百科tains the following: mail => mail.SomeProperty
.
I want to generate a new member expression to access one level deeper in the hierarchy and have some result like the following: mail => mail.SomeProperty.OtherProperty
.
How to do this?
I believe you can use Expression.Property to construct a new MemberExpression that wraps the existing expression with an additional property reference. It takes an Expression for the first argument, which should be the original MemberExpression.
精彩评论