简体   繁体   中英

Which collection does not implement IEnumerable

Is there any type of collection under System.Collections that does not inherit from IEnumerable or IEnumerable<T> ?

I need an example.

No class directly inside System.Collections will implement IEnumerable<T> - that namespace predates generics in .NET - however the classes which could roughly be defined "Collections" in that namespace all implement IEnumerable

  • ArrayList
  • BitArray
  • CollectionBase
  • DictionaryBase
  • Hashtable
  • Queue
  • ReadOnlyCollectionBase
  • SortedList
  • Stack

If we expand to "Any namespace below System.Collections " we get into System.Collections.Generic and System.Collections.ObjectModel and System.Collections.Specialized - all the collections classes inside them implement IEnumerable , IEnumerable<T> or both.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM