C#语言采用分组统计方法对列表中的重复项数量进行计算
发布时间
阅读量:
阅读量
希望对某一列表中出现多次的元素进行计数统计。
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace 统计元素重复出现次数
{
class Program
{
static void Main(string[] args)
{
//还是用的分组思想
List<Pet> nums =new List<Pet> {
new Pet{Name="abc",Age=18,Count=0 },
new Pet{Name="abc",Age=18,Count=0 },
new Pet{Name="abc",Age=18,Count=0 },
new Pet{Name="abc",Age=18,Count=0 },
new Pet{Name="Tro",Ag
全部评论 (0)
还没有任何评论哟~
