0

In the documentation it says:

Single-dimensional arrays implement the System.Collections.Generic.IList<T>, System.Collections.Generic.ICollection<T>, System.Collections.Generic.IEnumerable<T>, System.Collections.Generic.IReadOnlyList<T> and System.Collections.Generic.IReadOnlyCollection<T> generic interfaces.

The implementations are provided to arrays at run time.

Why are the provided at run-time, and not in the Array class definition?

Community
  • 1
  • 1
David Klempfner
  • 8,700
  • 20
  • 73
  • 153
  • Not sure what you're expecting for an answer but all of these represent (naming) and provide (interface) different functionality. – Canica Dec 01 '19 at 03:00
  • 1
    Does this answer your question? [Why isn't Array a generic type?](https://stackoverflow.com/questions/14324987/why-isnt-array-a-generic-type) (via [Why does an array get extension methods from generic IEnumerable through a back door?](https://stackoverflow.com/q/44656480/150605)) – Lance U. Matthews Dec 01 '19 at 03:02
  • `Why are the provided at run-time, and not in the Array class definition?` Because to do so in the class, then it would be a generic class. Arrays were around long before generics. That's just my guess. – CodingYoshi Dec 01 '19 at 03:11
  • The "why" is fairly involved, but fortunately already discussed to death on Stack Overflow. See marked duplicates for historical context and explanation of why and how arrays work the way they do. – Peter Duniho Dec 01 '19 at 03:17

0 Answers0