1

The Array class in C# is an abstract class even though it doesn't seem to have any abstract methods in it. Why is the Array Class in C# an abstract class?

I am aware that one cannot create an instance of Array using the new keyword since its abstract, but one can create an array using Array.CreateInstance(). I am curious if instantiation is the only reason why Array is an abstract class?

Turo
  • 4,724
  • 2
  • 14
  • 27
PW11
  • 11
  • 3
  • From the docs: *Provides methods for creating, manipulating, searching, and sorting arrays, thereby serving as the **base class** for all arrays in the common language runtime.* – Sir Rufo Feb 28 '20 at 06:18
  • 2
    [Documentation](https://learn.microsoft.com/en-us/dotnet/api/system.array?view=netframework-4.8) is a good place to start if you have questions. Look at why its abstract and what it implements – Jawad Feb 28 '20 at 06:19
  • Relevant: https://stackoverflow.com/questions/2999944/why-does-c-sharp-allow-for-an-abstract-class-with-no-abstract-members – default locale Feb 28 '20 at 06:20
  • 1
    Asking why a language feature was made is as futile as it is unrewarding. The only people that can truly answer are the people who made that decision. However what we do know is what we find in the documentation. – TheGeneral Feb 28 '20 at 06:23
  • This might be illuminating ... https://stackoverflow.com/questions/5163332/c-sharp-where-do-arrays-inherit-from-i-e-int – Mick Feb 28 '20 at 06:48
  • Does this answer your question? [Why does C# allow for an abstract class with no abstract members?](https://stackoverflow.com/questions/2999944/why-does-c-sharp-allow-for-an-abstract-class-with-no-abstract-members) – Sathish Guru V Feb 28 '20 at 07:30
  • Thank you for your helpful responses. I guess the link posted by @Mick was helpful – PW11 Feb 28 '20 at 08:54
  • Link posted by @SathishGuru was helpful too. Thanks! – PW11 Feb 28 '20 at 08:55

0 Answers0