[英]Collection<T>: why does it implement both IEnumerable and IEnumerable<T>?
[英]Which collection does not implement IEnumerable
System.Collections
下是否有不从IEnumerable
或IEnumerable<T>
继承的任何类型的集合?
我需要一个例子。
没有直接在System.Collections
内部的类将实现IEnumerable<T>
-该名称空间早于.NET中的泛型-但是可以在该名称空间中大致定义为“ Collections”的类都实现IEnumerable
如果我们扩展到“ System.Collections
下面的任何命名空间”, System.Collections.ObjectModel
进入System.Collections.Generic
和System.Collections.ObjectModel
和System.Collections.Specialized
它们中的所有collection类都实现IEnumerable
, IEnumerable<T>
或两者。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.