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();就可以执行了呢?
森栏
眼眸繁星