Author Message

PostPosted: Visual C# General, Capacity Top

what is the capacity of Arraylist and the hash table in visual c#...

Visual C#5  

PostPosted: Visual C# General, Capacity Top

There is no fixed size as capacity of all the collection classses in .Net whether it belongs to System.Collections or System.Collections.Generics namespaces inclduing both HashTable and ArrayList. As much as you add items in them its size is dynamically increased unlike normal arrays.

Best Regards,


Peter Ritchie

PostPosted: Visual C# General, Capacity Top

Syntactically, ArrayList.Count and ArrayList.Capacity are of type int, so they could only handle Int32.MaxValue values, limiting ArrayList to 2,147,483,647 values.  In reality, depending on object size and memory, the limit of ArrayList is arbitrarily smaller than this.  HashTable.Count is also of type int and the interfaces returned to navigate the collections contained in a HashTable also use an index of type int, so it would suffer the same limitiations.