如果我有这样的一个类
我的问题是如何检查
public class Test
{
public string Id {get; set;}
public string Name {get; set;}
public int Value {get; set;}
}
然后:
List<Test> values = new List<Test>(); // this contains let's say 10 items
我喜欢这样做:
var grouped = values.Where(x=>x.Value > 10).GroupBy(x=>x.Name);
我的问题是如何检查
grouped == null
,或者如何检查没有符合该条件的分组?我问这个问题是因为如果我像这样做:if (grouped == null) // this is false although the linq yielded no results
{
}