I have a problem with using the ConstantExpression
class:
Expression exp = Expression.Constant("1", typeof(Int32));
When executing the code from above, the following error is thrown.
Parameter type mismatch
How can I use the Constant(object value, Type type)
method?
您传递了一个字符串,表示1
,而只是使用没有双引号的数字:
Expression exp = Expression.Constant(1, typeof(Int32));
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.