加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

c# – 推荐.NET类用于集合唯一的整数?

发布时间:2020-12-15 03:59:49 所属栏目:百科 来源:网络整理
导读:你会推荐什么类需要保留一个唯一的整数列表? 我想要将Add()整数加入到集合中,并且还检查存在.载有(). 也可以将它们作为一个字符串显示在列表中,即. “1,5,10,21”. 解决方法 HashSet: The HashSetT class provides high-performance set operations. A set
你会推荐什么类需要保留一个唯一的整数列表?

我想要将Add()整数加入到集合中,并且还检查存在.载有().

也可以将它们作为一个字符串显示在列表中,即. “1,5,10,21”.

解决方法

HashSet:

The HashSet<T> class provides high-performance set operations. A set is a collection that contains no duplicate elements,and whose elements are in no particular order…

The capacity of a HashSet<T> object is the number of elements that the object can hold. A HashSet<T> object’s capacity automatically increases as elements are added to the object.

The HashSet<T> class is based on the model of mathematical sets and provides high-performance set operations similar to accessing the keys of the 07001 or 07002 collections. In simple terms,the HashSet<T> class can be thought of as a 07001 collection without values.

A HashSet<T> collection is not sorted and cannot contain duplicate elements…

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读