standards-c-sharp

Do not use Arrays, except…

Arrays simply do not model any problem that I have at all well – I rarely need a collection which has the rather contradictory properties of being completely mutable, and at the same time, fixed in size. If I want to mutate a collection it is almost always to add something to it or remove something from it, not to change what value an index maps to.

We have a class or interface for everything I need. If I need a sequence I’ll use IEnumerable<T>, if I need a mapping from contiguous numbers to data I’ll use a List<T>, if I need a mapping across arbitrary data I’ll use a Dictionary<K,V>, if I need a set I’ll use a HashSet<T>. I simply don’t need arrays for anything, so I almost never use them. They don’t solve a problem I have better than the other tools at my disposal.

Eric Lippert - Arrays considered somewhat harmful

I make a lot of use of arrays in my protobuf-net project; entirely for performance:

But this is definitely an exception; for general line-of-business processing, a List<T> wins every time.

Marc Gravell - StackOverflow