/ Published in: C#
Creating the equivalent of (ParentType x) => x.SomeProperty when the property is unknown until runtime
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
var memberExpression = Expression.Property(parameterExpression, propertyName); var result = (Expression<Func<ParentType, PropertyType>>)Expression.Lambda(memberExpression, parameterExpression);