用于存储唯一字符串的集合?

编程入门 行业动态 更新时间:2024-10-17 11:28:44
本文介绍了用于存储唯一字符串的集合?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我正在寻找一个像 Dictionary(OF Key,Value)的集合,但我实际上不需要键和值。密钥本身就足够了。所以像 Collection(Key)。它不应该接受重复的键。

我在.NET Framework中查找了几个集合,但是找不到我想要的。目前我滥用 Dictionary(OF String,String)并将值设置为 Nothing 。 >

我是否继续滥用字典(OF T,T)?

解决方案

我认为您想要的是 HashSet< T> 。 p>

I'm looking for a collection just like Dictionary(OF Key, Value) but I don't actually need a key and value. Key itself is enough. So something like Collection(Key). It shouldn't accept duplicate keys.

I've looked up couple of collections in .NET Framework but couldn't find what I want. Currently I'm abusing Dictionary(OF String, String) and setting Value as Nothing all the time.

Shall I just continue abusing Dictionary(OF T,T)?

解决方案

I think what you want is a HashSet<T>.

更多推荐

用于存储唯一字符串的集合?

本文发布于:2023-11-29 12:33:43,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1646408.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:字符串

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!