简体   繁体   中英

Why Enumerable does not implement IEnumerable?

I was looking to the metadata of the .Net framework trying to understand collections, and I saw that collections implement IEnumerable and IEnumerable<T> .

Then I looked at Enumerable and I found that it provides a set of static methods for querying objects that implement IEnumerable .

My question is, why Enumerable does not implement IEnumerable ?

Or in other words, why it was named like that since it does not implement IEnumerable?

Thanks in advance for your help!

Enumerable provides a set of static methods

Enumerable is also a static class.

what will happen if it does?

The code would not compile - A static class cannot implement an interface. I agree by the naming convention you'd expect otherwise. But there you go.

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