Export (0) Print
Expand All

CollectionsUtil Class

Creates collections that ignore the case in strings.

For a list of all members of this type, see CollectionsUtil Members.

System.Object
   System.Collections.Specialized.CollectionsUtil

[Visual Basic]
Public Class CollectionsUtil
[C#]
public class CollectionsUtil
[C++]
public __gc class CollectionsUtil
[JScript]
public class CollectionsUtil

Thread Safety

A Hashtable can support one writer and multiple readers concurrently. To support multiple writers, all operations must be done through the wrapper returned by the Synchronized method.

A SortedList can 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 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.

Remarks

These methods generate a case-insensitive instance of the collection using case-insensitive implementations of the hash code provider and the comparer. The resulting instance can be used like any other instances of that class, although it may behave differently.

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.

Requirements

Namespace: System.Collections.Specialized

Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family

Assembly: System (in System.dll)

See Also

CollectionsUtil Members | System.Collections.Specialized Namespace | System.Collections | Performing Culture-Insensitive String Operations in Collections

Show:
© 2014 Microsoft