public class CollectionsUtil
|
A SortedList can safely support multiple readers concurrently, as long as the collection is not modified. To guarantee the thread safety of the SortedList, all operations must be done through the wrapper returned by the SortedList.Synchronized method.
Enumerating through a collection is intrinsically not a thread-safe procedure. Even when a collection is synchronized, other threads could still modify the collection, which causes the enumerator to throw an exception. To guarantee thread safety during enumeration, you can either lock the collection during the entire enumeration or catch the exceptions resulting from changes made by other threads.
For example, suppose two objects with the keys "hello" and "HELLO" are to be added to a hash table. A case-sensitive hash table would create two different entries; whereas, a case-insensitive hash table would throw an exception when adding the second object.
ctor #1 | Default constructor. This constructor is called by derived class constructors to initialize state in this type. |
CreateCaseInsensitiveHashtable | Overloaded:CreateCaseInsensitiveHashtable() Creates a new case-insensitive instance of the Hashtable class with the default initial capacity. |
CreateCaseInsensitiveHashtable | Overloaded:CreateCaseInsensitiveHashtable(IDictionary d) Copies the entries from the specified dictionary to a new case-insensitive instance of the Hashtable class with the same initial capacity as the number of entries copied. |
CreateCaseInsensitiveHashtable | Overloaded:CreateCaseInsensitiveHashtable(int capacity) Creates a new case-insensitive instance of the Hashtable class with the specified initial capacity. |
CreateCaseInsensitiveSortedList | Creates a new instance of the SortedList class that ignores the case of strings. |
Equals (inherited from System.Object) |
See base class member description: System.Object.Equals Derived from System.Object, the primary base class for all objects. |
GetHashCode (inherited from System.Object) |
See base class member description: System.Object.GetHashCode Derived from System.Object, the primary base class for all objects. |
GetType (inherited from System.Object) |
See base class member description: System.Object.GetType Derived from System.Object, the primary base class for all objects. |
ToString (inherited from System.Object) |
See base class member description: System.Object.ToString Derived from System.Object, the primary base class for all objects. |
Finalize (inherited from System.Object) |
See base class member description: System.Object.Finalize Derived from System.Object, the primary base class for all objects. |
MemberwiseClone (inherited from System.Object) |
See base class member description: System.Object.MemberwiseClone Derived from System.Object, the primary base class for all objects. |
Hierarchy:
public CollectionsUtil(); |
public static Hashtable CreateCaseInsensitiveHashtable(); |
public static Hashtable CreateCaseInsensitiveHashtable( |
d
Exception Type | Condition |
---|---|
ArgumentNullException | d is null. |
capacity
Exception Type | Condition |
---|---|
ArgumentOutOfRangeException | capacity is less than zero. |
public static SortedList CreateCaseInsensitiveSortedList(); |
~CollectionsUtil(); |
public virtual int GetHashCode(); |
public Type GetType(); |
protected object MemberwiseClone(); |
public virtual string ToString(); |