Why does T[] stand for array and not IEnumerable<T> in C#?
I know that generics were introduced in .NET 2.0. If it was designed from scratch, does it make any sense to map [] to array? Actively using LINQ extension methods, I’d prefer to write simple T[] instead of bulky IEnumerable<T> or explicit .ToArray().
I’m wondering just for academic reasons.
T[]is the standard syntax for arrays for statically-typed C-like languages. If .NET 1.0 had generics, arrays might have used anArray<T>type.At any rate, if
T[]was used forIEnumerable<T>it could only be used in declarations and you wouldn’t be able to create one usingnew T[] { ... }. As far as interfaces go, it would make more sense to map it toIList<T>since the square brackets imply indexing.