猿问

动态构建Lambda 的问题,请指教,急!

public class Person
{
public string Name { get; set; }
public int Age { get; set; }
public int Salary { get; set; }
}
List
<Person> Persons=new List<Person> ()
Type TType
=typeof(Person);

ParameterExpression pp
= Expression.Parameter(TType, "p");

Expression temp
= Expression.GreaterThan(Expression.Call(Expression.Property(pp, TType.GetProperty("Age")), ??????),
Expression.Constant(
20));
var lambda
= Expression.Lambda<Func<Person, bool>>(temp, pp);

我想动态构建出Persons.Where(p=>p.Age>20).ToList(); 表达式请问怎么写啊!请帮帮忙!一个新手的求救!

UYOU
浏览 310回答 1
1回答
随时随地看视频慕课网APP
我要回答