Provides the abstract base class for a strongly typed collection of key/value pairs.
Assembly: mscorlib (in mscorlib.dll)
Thetype exposes the following members.
|Clear||Clears the contents of the instance.|
|CopyTo||Copies the elements to a one-dimensional Array at the specified index.|
|Equals(Object)||Determines whether the specified object is equal to the current object. (Inherited from Object.)|
|Finalize||Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.)|
|GetEnumerator||Returns an IDictionaryEnumerator that iterates through the instance.|
|GetHashCode||Serves as the default hash function. (Inherited from Object.)|
|GetType||Gets the Type of the current instance. (Inherited from Object.)|
|MemberwiseClone||Creates a shallow copy of the current Object. (Inherited from Object.)|
|OnClear||Performs additional custom processes before clearing the contents of the instance.|
|OnClearComplete||Performs additional custom processes after clearing the contents of the instance.|
|OnGet||Gets the element with the specified key and value in the instance.|
|OnInsert||Performs additional custom processes before inserting a new element into the instance.|
|OnInsertComplete||Performs additional custom processes after inserting a new element into the instance.|
|OnRemove||Performs additional custom processes before removing an element from the instance.|
|OnRemoveComplete||Performs additional custom processes after removing an element from the instance.|
|OnSet||Performs additional custom processes before setting a value in the instance.|
|OnSetComplete||Performs additional custom processes after setting a value in the instance.|
|OnValidate||Performs additional custom processes when validating the element with the specified key and value.|
|ToString||Returns a string that represents the current object. (Inherited from Object.)|
|AsParallel||Enables parallelization of a query. (Defined by ParallelEnumerable.)|
|AsQueryable||Converts an IEnumerable to an IQueryable. (Defined by Queryable.)|
|Cast(TResult)||Casts the elements of an IEnumerable to the specified type. (Defined by Enumerable.)|
|OfType(TResult)||Filters the elements of an IEnumerable based on a specified type. (Defined by Enumerable.)|
|ICollection.IsSynchronized||Gets a value indicating whether access to a object is synchronized (thread safe).|
|ICollection.SyncRoot||Gets an object that can be used to synchronize access to a object.|
|IDictionary.Add||Adds an element with the specified key and value into the .|
|IDictionary.Contains||Determines whether the contains a specific key.|
|IDictionary.IsFixedSize||Gets a value indicating whether a object has a fixed size.|
|IDictionary.IsReadOnly||Gets a value indicating whether a object is read-only.|
|IDictionary.Item||Gets or sets the value associated with the specified key.|
|IDictionary.Keys||Gets an ICollection object containing the keys in the object.|
|IDictionary.Remove||Removes the element with the specified key from the .|
|IDictionary.Values||Gets an ICollection object containing the values in the object.|
|IEnumerable.GetEnumerator||Returns an IEnumerator that iterates through the .|
The foreach statement of the C# language (for each in Visual Basic) returns an object of the type of the elements in the collection. Since each element of the is a key/value pair, the element type is not the type of the key or the type of the value. Instead, the element type is DictionaryEntry.
The foreach statement is a wrapper around the enumerator, which only allows reading from, not writing to, the collection.
Because keys can be inherited and their behavior changed, their absolute uniqueness cannot be guaranteed by comparisons using the Equals method.
This base class is provided to make it easier for implementers to create a strongly typed custom collection. Implementers are encouraged to extend this base class instead of creating their own.
Members of this base class are protected and are intended to be used through a derived class only.
Public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
This implementation does not provide a synchronized (thread-safe) wrapper for a , but derived classes can create their own synchronized versions of the using the SyncRoot property.
Enumerating through a collection is intrinsically not a thread-safe procedure. Even when a collection is synchronized, other threads can 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.