ilyes
ilyes

Reputation: 372

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!

Upvotes: 0

Views: 190

Answers (1)

Jonesopolis
Jonesopolis

Reputation: 25370

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.

Upvotes: 3

Related Questions