Tag Archives: IEnumerable

Playing around with List<T>, part two: IEnumerable and IEnumerable<T> implementation

After a while I finally found some time to write another post about List<T> internals. This time it’s all about enumeration, so I’m going to go through both non-generic IEnumerable and generic IEnumerable<T> interfaces implementation.

It may be a little bit surprising, but there are actually three GetEnumerator() methods within List<T> class. That’s because both IEnumerable.GetEnumerator() and IEnumerable<T>.GetEnumerator() methods are implemented explicitly (and there is another one, not connected to any of the interfaces):
Continue reading Playing around with List<T>, part two: IEnumerable and IEnumerable<T> implementation