variable '' of type '' referenced from scope '', but it is not defined 异常解决方法
最近在做一个功能,通过拼接lamdba表达试来实现的功能,但测试时总是出现一个错误,如下图所示,网上也找不到答案,差点都放弃了。。

如上图图所示,我是想通过一个lamdba表达式(上图的IdField属性)来拼接一个新的lamdba表达式(上图的GetById方法中的exp),当然上面只是演示效果,并不是我实际功能的代码。
总是出现异常,我还特意创建另一个lamdba变量exp2,表达式跟exp一样,然后用exp2就不出错,exp跟exp2我比对过,都是一模一样的,真是百思不得其姐。
当然后面我还是解决了,怎么解决呢,如下图

加了一个临时变量,引用IdField属性,然后创建lamdba表达式时用这个临时变量,就不出错了,根据它的报错的翻译,是作用域的问题引用的,具体的我还不懂,先记录下,给同样遇到我这个错误的朋友一点帮助。
variable '' of type '' referenced from scope '', but it is not defined 异常解决方法的更多相关文章
- Linq查询条件里有可空字段比较时报错variable '<>h__TransparentIdentifier2' of type referenced from scope '', but it is not defined
当我运行下面的linq查询时报了这个错, 1: var result = (from so in svcContext.new_sales_orderSet 2: join soitem in s ...
- The return type is incompatible with JspSourceDependent.getDependants():JasperException问题分析与解决方法
Linux下基于JSP的报表集成到项目中后,显示不出来,查看tomcat的日志.有例如以下报错信息: The return type is incompatible with JspSourceDep ...
- error C4430: missing type specifier - int assumed. Note: C++ does not support default-int 解决方法
在VS2012中生成时出错:error C4430: missing type specifier - int assumed. Note: C++ does not support default- ...
- Type.GetType()在跨程序集反射时返回null的解决方法
在开发中,经常会遇到这种情况,在程序集A.dll中需要反射程序集B.dll中的类型.如果使用稍有不慎,就会产生运行时错误.例如使用Type.GetType("BNameSpace.Class ...
- Dynamics CRM2015 The plug-in type does not exist in the specified assembly问题的解决方法
在用插件工具PluginProfiler调试时,报"The plug-in type xxxx does not exist in the specified assembly" ...
- 关于在调用JAVAFX相关包时遇到Access restriction: The type 'Application' is not API (restriction on required library)的解决方法
点击工具栏的Project->Properties->Java Build Path->Libraries-> 双击第一项 点击Add添加允许javafx 然后就不会报错了
- 【java】关于Cannot refer to the non-final local variable list defined in an enclosing scope解决方法
今天学习中遇到了一个问题: Cannot refer to the non-final local variable list defined in an enclosing scope 这里的new ...
- 出现UnboundLocalError: local variable 'a' referenced before assignment异常的情况与解决方法
出现UnboundLocalError: local variable ‘a’ referenced before assignment异常的情况与解决方法字面意思:局部变量赋值前被引用原因:局部变量 ...
- javax.servlet.ServletException cannot be resolved to a type错误解决方法
在页面中使用全局路径时${pageContext.request.contextPath}出现javax.servlet.ServletException cannot be resolved to ...
随机推荐
- 第二章 Unity Shader基础
[TOC] 1. Unity Shader 的基础: ShaderLab 学习和编写着色器的过程一直是一个学习曲线很陡峭的过程,通常情况下为了自定义渲染效果往往要和很多文件和设置打交道,这些设置很容易 ...
- 个性的圆角.html
- #华为云·寻找黑马程序员# 如何实现一个优雅的Python的Json序列化库
在Python的世界里,将一个对象以json格式进行序列化或反序列化一直是一个问题.Python标准库里面提供了json序列化的工具,我们可以简单的用json.dumps来将一个对象序列化.但是这种序 ...
- “智慧海绵城市”(SSC)监测评价体系整体解决方案
一.方案简介 无论是内涝防治.黑臭水体治理,还是海绵城市规划设计及建设.评估,乃至未来智慧城市的建设,都需要有全面.致密.大量的城市水文监测数据和先进模拟仿真技术作基础支撑,唯有如此,决策才有据可依, ...
- 转:关于java.lang.ClassNotFoundException: org.springframework.boot.SpringApplication的解决
在这个控制板中,出现了这个问题 java.lang.ClassNotFoundException: org.springframework.boot.SpringApplication 虽然明显知道是 ...
- 【集合系列】- 深入浅出的分析 Properties
一.摘要 在集合系列的第一章,咱们了解到,Map 的实现类有 HashMap.LinkedHashMap.TreeMap.IdentityHashMap.WeakHashMap.Hashtable.P ...
- WARNING: Your kernel does not support swap limit capabilities. Limitation discarded.
利用vSphere调整各台虚拟机后,重新启动mesos,让其启动docker,并为每个container分配cpu和mem,但每次都有一个TASK_LOST. 查看mesos slave的log,发现 ...
- libcurl库浅析
先放上libcurl官方文档:链接 第一步:全局初始化 #include <curl/curl.h> CURLcode curl_global_init(long flags ); 在使用 ...
- POJ 3281 Dining(网络流-拆点)
Cows are such finicky eaters. Each cow has a preference for certain foods and drinks, and she will c ...
- java虚拟机栈 相关操作
针对JVM虚拟栈 和栈帧的操作 虚拟机栈: 栈元素是栈帧.方法调用,栈帧入栈,反之出栈. 栈帧:一个方法的运行空间. 1.局部变量表:方法定义的局部变量.方法的参数存在该表. 实例方法中有个隐含参数“ ...