为什么Enumerable不实现IEnumerable?

问题描述 投票:0回答:1

[我一直在试图了解集合的.Net框架的元数据,并且我看到集合实现IEnumerable和IEnumerable。

然后,我查看了Enumerable,发现它提供了一组静态方法来查询实现IEnumerable的对象。

我的问题是,为什么Enumerable不实现IEnumerable?如果会发生什么呢?

谢谢您的帮助!

c# collections ienumerable enumerable
1个回答
0
投票

Enumerable提供了一组静态方法

Enumerable也是静态类。

如果发生的话会发生什么?

代码无法编译-static类无法实现接口。

© www.soinside.com 2019 - 2024. All rights reserved.