【发布时间】:2010-01-27 01:15:46
【问题描述】:
我在 LINQ 中有以下查询。 “符号”不存在,查询为空,但我得到一个错误,铸造和程序崩溃。
decimal x = from cie in m_entities.Cie
where cie.symbol.Equals(Symbol)
select cie.cie_id;
或者我可以在 x 中有一个 null 吗?
【问题讨论】:
-
您收到的确切异常消息是什么?
-
假设
m_entities.Cie是一个IQueryable 或IEnumerable,这个程序如何编译以在运行时产生异常,因为查询的结果应该是一个IEnumerable 而不是小数?
标签: c# linq entity-framework