In C#, Internally List encapsulate Array.In both data structure we can access the element using index.
List<T>
equals Array[T]
and support adding/removing items.
If the capacity of the list is full then, internally new array with size equals to 2 * capacity will be created and all element are moved to new array. Is this true?
If true,then size of the array and list are increased dynamically.
What are the benefits of using List<T>
over Array[T]
with Array.Resize(ref myArray, 2*size);
?