Creates a new StringTable with the specified initial capacity and the default load factor.
[Visual Basic] Overloads Public Sub New( _ ByVal capacity As Integer _ ) [C#] public StringTable( int capacity ); [C++] public: StringTable( int capacity ); [JScript] public function StringTable( capacity : int );
Exception Type | Condition |
---|---|
ArgumentOutOfRangeException | capacity is less than zero. |
Specifying the initial capacity eliminates a number of resizing operations that would otherwise be performed while adding entries to the StringTable. Capacity is increased as the number of buckets is increased based on the load factor.
The maximum load factor is the maximum ratio of entries to buckets. A smaller load factor means faster lookup at the cost of increased memory consumption. The default maximum load factor is 0.73, which is the best balance between speed and size.
When the actual load factor reaches the maximum load factor, the number of buckets is automatically increased to the smallest prime number that is larger than twice the current number of buckets.
StringTable Class | StringTable Members | System.Collections Namespace | StringTable Constructor Overload List