对Hashset .Net 3.5排序 [英] Sort a Hashset .Net 3.5

查看:98
本文介绍了对Hashset .Net 3.5排序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在c#.Net 3.5中对 HashSet< string> 进行排序?

How can one sort a HashSet<string> in c# .Net 3.5 ?

推荐答案

您不知道。根据定义, HashSet 不会排序。

You don't. By definition, a HashSet is not sorted.

如果要排序的哈希集,则应使用 SortedSet 。它公开的方法实质上是 HashSet 提供的方法的超集,包括对内容进行排序的能力。

If you want a sorted hash set, then you should use a SortedSet. The methods it exposes are essentially a superset of those provided by HashSet, including the ability to sort its contents.

这篇关于对Hashset .Net 3.5排序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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