C#设置集合? [英] C# Set collection?

查看:87
本文介绍了C#设置集合?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有人知道是否有一个好的等同于C#中的 Set 集合?我知道你可以使用字典 HashTable 通过填充但忽略的值来模仿一个集合,但是不是一个非常优雅的方式。

Does anyone know if there is a good equivalent to Java's Set collection in C#? I know that you can somewhat mimic a set using a Dictionary or a HashTable by populating but ignoring the values, but that's not a very elegant way.

推荐答案

如果您使用.NET 3.5,可以使用 HashSet< T> 。这是真的.NET不满足集以及Java以及尽管。

If you're using .NET 3.5, you can use HashSet<T>. It's true that .NET doesn't cater for sets as well as Java does though.

Wintellect PowerCollections 也可以帮助。

这篇关于C#设置集合?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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