更新时间:2023-02-13 22:10:06
您可以使用 GroupBy
,然后使用 Where(g => g.Count()== 1)
过滤掉所有重复的记录:
You can use GroupBy
, followed by Where (g => g.Count() == 1)
to filter out all records that have duplicates:
var res = orig.GroupBy(x => x).Where(g => g.Count() == 1).Select(g => g.Key);
为此,您仍然需要覆盖 GetHashCode
和 Equals
.
In order for this to work, you still need to override GetHashCode
and Equals
.