哪个集合没有实现 IEnumerable

Which collection does not implement IEnumerable

System.Collections 下是否有任何类型的集合不继承自 IEnumerableIEnumerable<T>

我需要一个例子。

No class directly inside System.Collections 将实现 IEnumerable<T> - 命名空间早于 .NET 中的泛型 - 但是 classes 可以在那个命名空间中粗略地定义 "Collections" 全部实现 IEnumerable

  • 数组列表
  • 位数组
  • 集合库
  • 词典库
  • 哈希表
  • 队列
  • ReadOnlyCollectionBase
  • 排序列表
  • 堆栈

如果我们扩展到 "Any namespace below System.Collections",我们将进入 System.Collections.GenericSystem.Collections.ObjectModelSystem.Collections.Specialized - 它们中的所有集合 classes 实现 IEnumerableIEnumerable<T> 或两者。