Enumerable.Distinct方法是一种常用的LINQ扩展方法,是System.Linq中的Enumerable方法,可以删除数组、集合中的重复元素,也可以自定义删除重量的规则
转载来源: https://www.cn blogs.com/Robert-go-go/p/5399198.html
有两种重载方法。
//
//摘要:
//通过使用默认等效比较器比较值,返回序列中的不重复元素。
//
//参数:
//source:
//从中删除重复元素的序列。
//
//类型参数:
//TSource:
//source中元素的类型。
//
返回//结果:
//包含源序列中非重复元素的system.collections.generic.ienumerable。
//
//异常:
//system.argumentnullexception :
//source为空。
publicstaticienumerabledistinct (thisienumerablesource );
//
//摘要:
//通过使用指定的system.collections.generic.iequalitycomparer比较值,返回序列中的不重复元素。
//