Expression的小问题,请大家看一下
MethodCallExpression left = Expression.Call(dateExpr, "CompareTo", new Type[] { typeof(string) }, Expression.Constant("20100501",typeof(string)));
为什么我这里一直说
No method 'CompareTo' on type 'System.String' is compatible with the supplied arguments.
------解决方案--------------------
MethodCallExpression left = Expression.Call(typeof(DateTime), "CompareTo", new Type[] { typeof(string) }, Expression.Constant("20100501"));
试试
这只是生成表达式,要调用它还得使用Linq的Provider