variable '' of type '' referenced from scope '', but it is not defined 异常解决方法

Recently doing a function, achieved by splicing lamdba expression function test, but the test is always an error, as shown below, the Internet can not find the answer, almost gave up. .

 

 As shown in FIG, I want to splice a new lamdba expression (FIG GetById methods in exp) through (IdField FIG attributes on) a lamdba expression, of course, is to demonstrate the above effect, not the actual I Code function.

Always abnormal, I deliberately create another lamdba exp2 variables, expressions like exp, then exp2 not wrong, exp exp2 with me than before, are exactly the same, really can not his sister.

Of course I was later resolved, how to solve it, as shown below

 

 With this temporary variable, do not mistake the addition of a temporary variable reference IdField property, and then create lamdba when the expression, based on its error in translation, the scope of the problem is cited, specifically I do not know, the first record next, I encountered this error to the same friends a little help.

Guess you like

Origin www.cnblogs.com/caijt/p/11875812.html