What is the difference between an array and a List<T> in C#?

C# Collections Basic Fresher1–2 Yrs Conceptual 1 min read

Quick Answer

An array has a fixed length set at creation. List<T> is a growable wrapper around an internal array that resizes (doubles capacity) as you Add. Use an array for a fixed-size buffer or hot-path performance; use List<T> for almost everything else because you rarely know the count up front.

An array is fixed size — you decide the length when you create it and it never changes. List<T> is backed by an array internally but it grows for you: when it fills up it allocates a bigger array, usually double, and copies. Both give you fast indexed access and are contiguous in memory. I use List<T> by default because I almost never know the exact count ahead of time, and if I do know it roughly I pass the capacity to the constructor to avoid the resizes. Arrays I keep for fixed buffers and tight performance-sensitive loops.

  • Both are O(1) index access and contiguous in memory.
  • List<T>.Add is amortised O(1); the occasional resize copies the whole backing array. Pass an initial capacity if you know the rough size.
  • Arrays are covariant (string[] is assignable to object[]) which is unsafe and can throw at runtime; List<T> is not.
  • Expose IReadOnlyList<T> / IEnumerable<T> on APIs rather than the concrete type.