簡體   English   中英

為什么 Enumerable 不實現 IEnumerable?

[英]Why Enumerable does not implement IEnumerable?

我正在尋找試圖理解集合的 .Net 框架的元數據,我看到集合實現了IEnumerableIEnumerable<T>

然后我查看了Enumerable ,我發現它提供了一組靜態方法來查詢實現IEnumerable對象。

我的問題是,為什么Enumerable不實現IEnumerable

或者換句話說,既然它沒有實現 IEnumerable,為什么要這樣命名?

在此先感謝您的幫助!

Enumerable 提供了一組靜態方法

Enumerable也是一個靜態類。

如果這樣做會發生什么?

代碼無法編譯 - static類無法實現接口。 我同意您所期望的命名約定。 但是你去了。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM