[英]exclude an element from a grouping
I am looking for duplicates in a dictionary of type Dictionary<long, MyClass>
using MyClass.some_property
as the comparison value: 我正在使用
MyClass.some_property
作为比较值在Dictionary<long, MyClass>
类型的Dictionary<long, MyClass>
寻找重复项:
var dict = new Dictionary<long, MyClass>(...);
var duplicates = from d in dict
group d by d.Value.some_property into g
where g.Count() > 1
select g;
Now I need to exclude the first element in each grouping in the duplicates
enumerable. 现在,我需要在可枚举
duplicates
每个分组中排除第一个元素。 How is this done without converting everything to another data structure? 如何在不将所有内容都转换为其他数据结构的情况下完成此操作? I want to avoid using any additional memory.
我想避免使用任何额外的内存。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.