in c# ArrayList is a collection
ArrayList a = new ArrayList();
a.Add(4); // capacity = 4 and count = 1
a.Add(4);
a.Add(4);
a.Add(4); //there the capacity is 4 count=4 so Capacity will be doubled if I add new element
//but when I add a new element
a.Add(5);
the capacity will be 8 as a new array with double old capacity will be created and the elements in old array will be copied to this array but when I see the hash code of the array (address) I found it the same so how can arrayList define a new array at heap and copy element to it but the address still the same ?
I expect different memory locations at heap but I found them the same does garbage collector do something behind the scene?