假设我有一个 Collection<string>
我正在使用 GetEnumerator()
返回 IEnumerator<string>
, 我在哪里可以找到 IEnumerator
的实现对于这个集合?
关于女士 site他们只是说:
Returns an enumerator that iterates through the Collection.
但是实现IEnumerator
的类在哪里? ?
最佳答案
调查 source我们可以看到 GetEnumerator
返回其“items
”的 GetEnumerator具体类型为List<T>
的字段(在构造函数内部)
那个GetEnumerator
返回 List<T>.Enumerator
的实例一个内部嵌套类,其源代码可用 here
关于c# - Collection<T>的IEnumerable的实现在哪里,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39688530/