variable '' of type '' referenced from scope '', but it is not defined

前端 未结 3 1386
生来不讨喜
生来不讨喜 2020-12-01 17:42

Well, the following code is self-explaining; I want to combine two expressions into one using And operator. The last line causes rune-time the error:

3条回答
  •  隐瞒了意图╮
    2020-12-01 18:31

    Thanks everybody collaborated.

    As @dasblinkenlight pointed out the two parameters in the two expressions are not the same. Reason? Well, it is the compiler trick. When compiling, it creates a class for each expression and name each parameter something like xxx1, xxx2,... completely different from the original names.

    And the answer for .Net 4.0+:

    How to Combine two lambdas

提交回复
热议问题