HashSet
是吗? .NET 3.5 中引入的集合在使用 foreach
迭代时保留插入顺序?
documentation声明该集合未排序,但它没有说明任何有关插入顺序的信息。预发布 BCL blog entry声明它是无序的,但是 this article声明它旨在保留插入顺序。我有限的测试表明,该顺序被保留,但这可能是巧合。
最佳答案
A set is a collection that contains no duplicate elements, and whose elements are in no particular order.
关于.net - HashSet 是否保留插入顺序?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/657263/