mscorlib 4.0.0.0 System.Object System.Collections.Generic.ICollection<System.Collections.Generic.KeyValuePair<TKey,TValue>> System.Collections.Generic.IDictionary<TKey,TValue> System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<TKey,TValue>> System.Collections.IDictionary System.Diagnostics.DebuggerDisplay("Count={Count}") System.Diagnostics.DebuggerTypeProxy(typeof(System.Collections.Generic.CollectionDebuggerView`2)) To be added. To be added.

For very large objects, you can increase the maximum array size to 2 gigabytes (GB) on a 64-bit system by setting the <gcAllowVeryLargeObjects> configuration element to true in the run-time environment.

Like the class, implements the interface. In addition, provides several methods for adding or updating key/value pairs in the dictionary, as described in the following table.

To do this

Use this method

Usage notes

Add a new key to the dictionary, if it doesn’t already exist in the dictionary

This method adds the specified key/value pair, if the key doesn’t currently exist in the dictionary. The method returns true or false depending on whether the new pair was added.

Update the value for an existing key in the dictionary, if that key has a specific value

This method checks whether the key has a specified value, and if it does, updates the key with a new value. It's similar to the method, except that it's used for dictionary elements.

Store a key/value pair in the dictionary unconditionally, and overwrite the value of a key that already exists

The indexer’s setter: dictionary[key] = newValue

Add a key/value pair to the dictionary, or if the key already exists, update the value for the key based on the key’s existing value

—or—

accepts the key and two delegates. It uses the first delegate if the key doesn’t exist in the dictionary; it accepts the key and returns the value that should be added for the key. It uses the second delegate if the key does exist; it accepts the key and its current value, and it returns the new value that should be set for the key.

accepts the key, a value to add, and the update delegate. This is the same as the previous overload, except that it doesn't use a delegate to add a key.

Get the value for a key in the dictionary, adding the value to the dictionary and returning it if the key doesn’t exist

—or—

These overloads provide lazy initialization for a key/value pair in the dictionary, adding the value only if it’s not there.

takes the value to be added if the key doesn’t exist.

takes a delegate that will generate the value if the key doesn’t exist.

All these operations are atomic and are thread-safe with regards to all other operations on the class. The only exceptions are the methods that accept a delegate, that is, and . For modifications and write operations to the dictionary, uses fine-grained locking to ensure thread safety. (Read operations on the dictionary are performed in a lock-free manner.) However, delegates for these methods are called outside the locks to avoid the problems that can arise from executing unknown code under a lock. Therefore, the code executed by these delegates is not subject to the atomicity of the operation.

Represents a thread-safe collection of key/value pairs that can be accessed by multiple threads concurrently.

- Constructor
  4.0.0.0

  The default concurrency level is the default concurrency multiplier (DEFAULT_CONCURRENCY_MULTIPLIER) times the number of CPUs. The higher the default concurrency multiplier is, the more concurrent write operations can take place without interference and blocking. Higher multiplier values also cause operations that require all locks (for example, table resizing, ToArray and Count) to become more expensive. The default concurrency multiplier is 4. The default capacity (DEFAULT_CAPACITY), which represents the initial number of buckets, is a trade-off between the size of a very small dictionary and the number of resizes when constructing a large dictionary. Also, the capacity should not be divisible by a small prime number. The default capacity is 31.

  Initializes a new instance of the class that is empty, has the default concurrency level, has the default initial capacity, and uses the default comparer for the key type.

- Constructor
  4.0.0.0
  To be added.
  To be added.
  To be added.
- Constructor
  4.0.0.0
  To be added.
  To be added.
  To be added.
- Constructor
  4.0.0.0
  To be added.
  To be added.
  To be added.
  To be added.
- Constructor
  4.0.0.0
  To be added.

  Initializes a new instance of the class that is empty, has the specified concurrency level and capacity, and uses the default comparer for the key type.

  The estimated number of threads that will update the concurrently.
  The initial number of elements that the can contain.
- Constructor
  4.0.0.0
  To be added.
  To be added.
  To be added.
  To be added.
  To be added.
- Constructor
  4.0.0.0
  To be added.
  To be added.
  To be added.
  To be added.
  To be added.
- Method
  4.0.0.0
  TValue `` `` `` To be added. To be added. To be added. To be added. To be added. To be added.
- Method
  4.0.0.0
  TValue `` `` `` To be added. To be added. To be added. To be added. To be added. To be added.
- Method
  4.0.0.0
  System.Void To be added.

  Removes all keys and values from the .

- Method
  4.0.0.0
  System.Boolean `` To be added. To be added. To be added. To be added.
- Property
  4.0.0.0
  System.Int32 To be added.

  This property has snapshot semantics and represents the number of items in the at the moment when the property was accessed.

  Gets the number of key/value pairs contained in the .

- Method
  4.0.0.0
  System.Collections.Generic.IEnumerator<System.Collections.Generic.KeyValuePair<TKey,TValue>>

  The enumerator returned from the dictionary is safe to use concurrently with reads and writes to the dictionary, however it does not represent a moment-in-time snapshot of the dictionary. The contents exposed through the enumerator may contain modifications made to the dictionary after was called.

  Returns an enumerator that iterates through the .

  An enumerator for the .

- Method
  4.0.0.0
  TValue `` `` To be added. To be added. To be added. To be added. To be added.
- Method
  4.0.0.0
  TValue `` `` To be added. To be added. To be added. To be added. To be added.
- Property
  4.0.0.0
  System.Boolean To be added. To be added.

  Gets a value that indicates whether the is empty.

- Property
  4.0.0.0
  TValue `` To be added. To be added. To be added. To be added.
- Property
  4.0.0.0
  System.Collections.Generic.ICollection<TKey> To be added. To be added.

  Gets a collection containing the keys in the .

- Method
  4.0.0.0
  System.Void `` To be added. To be added. To be added.
- Method
  4.0.0.0
  System.Boolean `` To be added. To be added. To be added. To be added.
- Method
  4.0.0.0
  System.Void `` `` To be added. To be added. To be added. To be added.
- Property
  4.0.0.0
  System.Boolean To be added. To be added. To be added.
- Method
  4.0.0.0
  System.Boolean `` To be added. To be added. To be added. To be added.
- Method
  4.0.0.0
  System.Void `` `` To be added. To be added. To be added. To be added.
- Method
  4.0.0.0
  System.Boolean `` To be added. To be added. To be added. To be added.
- Method
  4.0.0.0
  System.Void `` `` To be added. To be added.

  Copies the elements of the to an array, starting at the specified array index.

  The one-dimensional array that is the destination of the elements copied from the . The array must have zero-based indexing.
- Property
  4.0.0.0
  System.Boolean To be added. To be added.

  Gets a value indicating whether access to the is synchronized with the SyncRoot.

- Property
  4.0.0.0
  System.Object To be added. To be added.

  Gets an object that can be used to synchronize access to the . This property is not supported.

- Method
  4.0.0.0
  System.Void `` `` To be added.

  Adds the specified key and value to the dictionary.

  The object to use as the key. The object to use as the value.
- Method
  4.0.0.0
  System.Boolean `` To be added.

  Gets whether the contains an element with the specified key.

  true if the contains an element with the specified key; otherwise, false.

  The key to locate in the .
- Method
  4.0.0.0
  System.Collections.IDictionaryEnumerator To be added.

  Provides a for the .

  A for the .

- Property
  4.0.0.0
  System.Boolean To be added. To be added.

  Gets a value indicating whether the has a fixed size.

- Property
  4.0.0.0
  System.Boolean To be added. To be added.

  Gets a value indicating whether the is read-only.

- Property
  4.0.0.0
  System.Object `` To be added. To be added. To be added. To be added.
- Property
  4.0.0.0
  System.Collections.ICollection To be added. To be added.

  Gets an that contains the keys of the .

- Method
  4.0.0.0
  System.Void `` To be added.

  Removes the element with the specified key from the .

  The key of the element to remove.
- Property
  4.0.0.0
  System.Collections.ICollection To be added. To be added.

  Gets an that contains the values in the .

- Method
  4.0.0.0
  System.Collections.IEnumerator

  The enumerator returned from the dictionary is safe to use concurrently with reads and writes to the dictionary, however it does not represent a moment-in-time snapshot of the dictionary. The contents exposed through the enumerator may contain modifications made to the dictionary after was called.

  Returns an enumerator that iterates through the .

  An enumerator for the .

- Method
  4.0.0.0
  System.Collections.Generic.KeyValuePair<TKey,TValue>[] To be added.

  Copies the key and value pairs stored in the to a new array.

  A new array containing a snapshot of key and value pairs copied from the .

- Method
  4.0.0.0
  System.Boolean `` `` To be added. To be added. To be added. To be added. To be added.
- Method
  4.0.0.0
  System.Boolean `` `` To be added. To be added. To be added. To be added. To be added.
- Method
  4.0.0.0
  System.Boolean `` `` To be added. To be added. To be added. To be added. To be added.
- Method
  4.0.0.0
  System.Boolean `` `` `` To be added. To be added. To be added. To be added. To be added. To be added.
- Property
  4.0.0.0
  System.Collections.Generic.ICollection<TValue> To be added. To be added.

  Gets a collection that contains the values in the .