我需要一个HashSet的是preserves插入排序,还有这实现任何框架中的?
I need a HashSet that preserves insertion ordering, are there any implementations of this in the framework?
您可以用得到这个功能,很容易 KeyedCollection< TKEY的,TItem>
指定相同类型参数TKEY的和TItem:
You can get this functionality easily using KeyedCollection<TKey,TItem>
specifying the same type argument for TKey and TItem:
public class OrderedHashSet<T> : KeyedCollection<T, T>
{
protected override T GetKeyForItem(T item)
{
return item;
}
}
上一篇:在64位.NET应用程序的内存限制?应用程序、内存、NET
下一篇:出现InvalidOperationException调用.NET实体框架的SaveChanges时实体、框架、InvalidOperationException、NET