更新时间:2023-01-24 10:31:05
var numSpecialBooks = StoreDisplayTypeList.Count(n => n.DisplayType == "Special Book");
这使用了 Enumerable.Count
的重载,该重载需要一个Func<TSource, bool>
谓词可过滤序列.
This uses an overload of Enumerable.Count
that takes aFunc<TSource, bool>
predicate to filter the sequence.