I know that the base abstract Array class doesn't implement generic IEnumerable as
public abstract class Array : ICloneable, IList, ICollection, IEnumerable, IStructuralComparable, IStructuralEquatable
{
...
}
so when I create a derive array class like int[] i;
or string[] s;
, do they implement IEnumerable<T>
? And how can I see the source code of []
?
You can check it simply like this:
Result is:
There is special type
SZArrayHelper
- wrapper around array. Here is source code: https://referencesource.microsoft.com/#mscorlib/system/array.cs,aa97964558672440Also, array implements
IList
, and it implementsICollection
and it implementsIEnumerable
. So, Array implementsIEnumerable
Official word here
Array Overview