Given a Member Access lambda expression, convert it to a specific string representation with full ac
- by Nathan
Given an
Expression<Func<T, object>>
(e.g. x = x.Prop1.SubProp), I want to create a string "Prop1.SubProp" for as deep as necessary.
In the case of a single access (e.g. x = x.Prop1), I can easily do this with:
MemberExpression body = (expression.Body.NodeType == ExpressionType.Convert) ?…