如果您有一个集合/List<> 对象,您如何从该集合/List<> 中选择不同的记录?
例如,我正在执行以下操作,但两者的计数相同:
var list = List<Order>;
list.add( new Order { Status = "Completed" });
list.add( new Order { Status = "Completed" });
list.add( new Order { Status = "Completed" });
list.add( new Order { Status = "Processing" });
var = completed = list.Select(x => x.Status == "Completed").Count();
var = Processing = list.Select(x => x.Status == "Processing").Count();
谢谢