C# 统计数组list中不同元素的个数 List<string> = allDefectCategory var counts = allDefectCategory.GroupBy(x => x).ToDictionary(x => x.Key, x => x.Count());