string[] codes = new string[]{"2008","2009","2010"};string ret = codes.FirstOrDefault<string>(item => item.CompareTo("2009") > 0);为什么执行这段代码会报异常:Expression cannot contain lambda expressions而改为:string ret = (from c in codes where item.CompareTo("2009") > 0 select c ).FirstOrDefault();就可以执行了呢?
- 2 回答
- 0 关注
- 319 浏览
添加回答
举报
0/150
提交
取消