开发者

how to build Expression<Func<x,y>> with no input parameters?

I use Expression.Call to build MethodCallExpression dynamically.开发者_运维技巧 The call is for "First" method. Then, I need to wrap it to Expression<Func<x,y>> (x and y are types, and it irrelevant to the question). I'm trying to do it with Expression.Lambda<Func<x,y>>, but get Incorrect number of parameters supplied for lambda declaration exception when passing

new ParameterExpression[]{} (i.e. empty array) in the ParameterExpression[] input parameter.

what should be provided to Expression.Lambda when the Lambda takes ZERO parameters?


Action is the delegate that corresponds to a void that accepts no parameters. Func<x, y> says that the method accepts an x and returns a y. All the Func delegates return values, and all the Action delegates are void.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜