While studying about IEnumerator and IEnumerator<T>, I came accross the following statement:-
If we call GetEnumerator() on any collection, we mostly get the type-safe version ie "generic" version, notable exception in this case is array which returns the classical(non-generic) version.
My question is that:-
Why do arrays return "classical" Enumerator upon calling the GetEnumerator() function, but other data-structures like List<T> and others return the generic Enumerator?
string[] tempString = "Hello World!" ;
var classicEnumerator = tempString.GetEnumerator() ; // non-generic version of enumerator.
List<string> tempList = new List<string> () ;
tempList.Add("Hello") ;
tempList.Add(" World") ;
var genericEnumerator = tempList.GetEnumerator() ; // generic version of enumerator.