日期:2014-05-20 浏览次数:20825 次
ParameterExpression numParam = Expression.Parameter(typeof(string), "str"); ConstantExpression b = Expression.Constant(true, typeof(bool)); MethodCallExpression methodCall = Expression.Call(typeof(string).GetMethod("IsNullOrEmpty"), numParam); BinaryExpression isEqual = Expression.NotEqual(methodCall, b); Expression<Func<string, bool>> lambda1 = Expression.Lambda<Func<string, bool>>( isEqual, new ParameterExpression[] { numParam });