System.Collections.Specialized
Specialized collections:Predefined collections that serve a special or highly specific purpose
Specialized String Collection :
StringCollection class: same behavior as the generic List class when elements are specified as string.
Strongly typed version of ArrayList
Accepts Null reference as a valid value.
Allow duplicate Element
Zero based index
String comparision is case sensitive
StringDictionary class: exact same behavior as the generic Dictionary class, when the key is specified as a string and the value is specified as a string.
Can accept a null value but the key cannot be a null reference
Case insensitive
StringEnumerator class provides enumeration for the string collection.
CollectionsUtil class allows to create a case insensitive Hashtable or a case insensitive SortedList.
Hashtable name=CollectionsUtil.CreateCaseInsensitiveHashtable();
Specialized Dictionary collection:
HybridDictionary class internally switches to either a ListDictionary or a Hashtable to store data, depending on the number of elements.
ListDictionary provides a better performance for less than 10 elements
Not suitable in conditions when performance is important.
Hashtable provides a better performance for more than 10 elements.
OrderedDictionary can store elements sorted by key and sorted by index. This class is very efficient if the number of elements is 10 or less than 10.
Specialized Named Collection:
The named collection classes provide the abstract base class for a collection of associated string keys and object values that you can access either by the key or by the index.
It allows multiple string values to be associated with a single string key.
It provides a class that you can derive from to create your own key/value collections, with their own specialized behavior
Default initial capacity for a NameValueCollection is zero.
Dynamically resizes.
In NameValueCollection, a null reference is allowed for either a key or a value.
Specialized Bit collection:
A BitVector32 provides a simple structure that stores Boolean values and small integers.
It stores Boolean values in a 32-bit structure hence more efficient than bit structure.
A BitVector32.Section is a window into the BitVector32 and is composed of the smallest number of consecutive bits that can contain the maximum value specified in CreateSection. For example, a section with a maximum value of 1 is composed of only one bit, whereas a section with a maximum value of 5 is composed of three bits
The BitVector32.Section allows you to store small integers within a BitVector32 class.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment