唯一的字符串C#的高效名单 [英] Efficient list of unique strings C#

查看:150
本文介绍了唯一的字符串C#的高效名单的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

什么是存储字符串忽略任何重复的列表,最有效的方法是什么?
我就在想一本字典可能是最好写的dict [STR] = FALSE插入串;并通过密钥作为列表列举。那是一个很好的解决方案。

What is the most efficient way to store a list of strings ignoring any duplicates? I was thinking a dictionary may be best inserting strings by writing dict[str] = false; and enumerating through the keys as a list. Is that a good solution?

推荐答案

如果您使用的是.NET 3.5中,的 HashSet的应该为你工作。

If you are using .NET 3.5, the HashSet should work for you.

&HashSet的LT (作者≤(T>)>)类提供
高性能集合操作。一组
为不包含
重复元素,并且其元素
是在任何特定的顺序的集合。

The HashSet<(Of <(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.

这篇关于唯一的字符串C#的高效名单的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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