8,497
社区成员
发帖
与我相关
我的任务
分享
public void Require(Expression<Func<Product1, string>> pro, string errorMessage)
{
//string proValue=pro得到值
if (string.IsNullOrEmpty(proValue))
{
throw new Exception(errorMessage);
}
}
public void Require(Expression<Func<Product1, string>> pro, string errorMessage)
{
Func<Product1, string> deleg=pro.Compile();
var p1=new Product1();
string proValue=deleg(p1);
if (string.IsNullOrEmpty(proValue))
{
throw new Exception(errorMessage);
}
}