唯一列表< T>在.NET 2 [英] Unique List<T> in .NET 2

查看:85
本文介绍了唯一列表< T>在.NET 2的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

什么是

  • preferably通用的;
  • 唯一(IComparable的/ IEquitable),价值
  • preferably generic;
  • unique(IComparable/IEquitable) valued

集合对象的 .NET 2

点菜名单,其中,T> ,或等效的的HashSet< T> 从.NET 3.5,但是没有订购项目)

(à la List<T>, or an equivalent of HashSet<T> from .NET 3.5, but without ordered items)

推荐答案

不幸的是,第一个良好的框架类,这是的 HashSet的,你将只能得到访问与.net 3.5。

Unfortunately, the first good framework class for this is the HashSet, which you will only get access to with .Net 3.5.

如果你是停留在previous版本,该选项是不一样漂亮。最常见的是USEA词典类型,其中最关键的是您要存储的值。您可以在自己的类相当容易换这个。

If you are stuck in previous versions., the options are not as nice. The most common is to usea Dictionary type where the Key is the value that you are trying to store. You can wrap this in your own class fairly easily.

如果你愿意的框架外走在一起,有数据结构的集合对于.NET,如的 NGenerics 的。

If you are willing to go outside the framework all together, there are collections of data structures for .Net, such as NGenerics.

这篇关于唯一列表&LT; T&GT;在.NET 2的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆