C# Hashtable Hashtable(Int32, Single)
Description
Hashtable Hashtable(Int32, Single)
initializes a new,
empty instance of the Hashtable class using the specified initial capacity
and load factor, and the default hash code provider and comparer.
Syntax
Hashtable.Hashtable(Int32, Single)
has the following syntax.
public Hashtable(
int capacity,
float loadFactor
)
Parameters
Hashtable.Hashtable(Int32, Single)
has the following parameters.
capacity
- The approximate number of elements that the Hashtable object can initially contain.loadFactor
- A number in the range from 0.1 through 1.0 that is multiplied by the default value which provides the best performance. The result is the maximum ratio of elements to buckets.
Example
using System;//from www . ja v a 2 s. com
using System.Collections;
using System.Globalization;
public class SamplesHashtable
{
public static void Main()
{
Hashtable myHT1 = new Hashtable(3, (float).8);
myHT1.Add("FIRST", "Hello");
myHT1.Add("SECOND", "World");
myHT1.Add("THIRD", "!");
}
}
The code above generates the following result.