Skip to main content
1 of 3
Arseni Mourzenko
  • 139.2k
  • 32
  • 359
  • 544

Two reasons.

An array, in C#, is a weird data structure: its length is immutable, but its elements are mutable. Such specificity is rarely needed. Actually, in twenty years of software development, I haven't yet seen a single case in C# where the author of a piece of code was actively seeking this specificity. I've seen a lot of cases where arrays were used wrongly, by someone who didn't know what arrays are, nor what are the other types, such as hash sets, collections, lists, queues, or double linked lists.

Also, an array is a bit low level for general use. A list is based on an array, and provides a good abstraction level over the actual way elements are stored in an array, or what happens when a list grows beneath the initial capacity of the underlying array. You may intentionally seek the low level provided by an array. But that shouldn't be your default choice by no means. And if you do seek low level stuff, spans may possibly be what you are looking for.

Arseni Mourzenko
  • 139.2k
  • 32
  • 359
  • 544