ExpressionHelper.cs 433 B

123456789101112131415
  1. using System;
  2. using System.Linq.Expressions;
  3. namespace VCommon.VApplication.Linq.Expressions
  4. {
  5. internal static class ExpressionHelper
  6. {
  7. public static Expression<Func<T, TV>> Property<T, TV>(string propertyName)
  8. {
  9. var p = Expression.Parameter(typeof(T));
  10. var body = Expression.Property(p, propertyName);
  11. return Expression.Lambda<Func<T, TV>>(body, p);
  12. }
  13. }
  14. }