Playing around with List<T>, part five - finding elements
27 Nov 2013This time I’ll try to examine how are all search-related methods in List<T>
implemented. Here is quite long list of all these methods:
by Marcin Juraszek
This time I’ll try to examine how are all search-related methods in List<T>
implemented. Here is quite long list of all these methods:
The last part of the series was all about increasing underlying array size. This time, I’ll try to investigate something slightly different. Question is simple: Is the underlying array shrunk when you remove elements from the list? Let’s find that out!
This time on the series I’m gonna examine how List<T>
ensures the underlying array capacity. But because it’s quite interesting topic I decided to focus on adding new elements to the list only, leaving deleting/clearing for the next part.
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.
List<T>
is one of the most commonly used types from .NET Framework Base Class Library. Although it is used so often not everyone is really familiar with how the class works internally. Almost everyone knows that List<T>
uses T[]
array internally to store the items. But for most people that’s the only internal detail they know. In next few blog post I’ll try to step through List<T>
source code and point some interesting implementation details that every .NET developer should be aware of.