我的代码如下:
var result = from x in Values where x.Value > 5 select x;
Run Code Online (Sandbox Code Playgroud)
然后,我想检查一下:
if(result.Count > 0) { ... }
else if(result.Count == 1) { ... }
else { throw new Exception(...); }
Run Code Online (Sandbox Code Playgroud)
但是,我得到的错误如下:
error CS0019: Operator '==' cannot be applied to operands of type 'method group' and 'int'
Run Code Online (Sandbox Code Playgroud)
我可以不用结果写一个foreach吗?