ConcurrentDictionary<TKey, TValue>
class ConcurrentDictionary<TKey, TValue> : IDictionary<TKey, TValue>, ICollection<KeyValuePair<TKey, TValue>>, IEnumerable<KeyValuePair<TKey, TValue>>, IEnumerable, IDictionary, ICollection
Represents a thread-safe collection of keys and values.
Gets the number of key/value pairs contained in the ConcurrentDictionary<T, U>.
Gets a value that indicates whether the ConcurrentDictionary<T, U> is empty.
Gets or sets the value associated with the specified key.
Gets a collection containing the keys in the Dictionary{TKey,TValue}.
Gets a collection containing the values in the Dictionary{TKey,TValue}.
public ConcurrentDictionary()
Initializes a new instance of the ConcurrentDictionary<T, U>
class that is empty, has the default concurrency level, has the default initial capacity, and
uses the default comparer for the key type.
Initializes a new instance of the ConcurrentDictionary<T, U>
class that is empty, has the specified concurrency level and capacity, and uses the default
comparer for the key type.
Initializes a new instance of the ConcurrentDictionary<T, U>
class that contains elements copied from the specified IEnumerable{KeyValuePair{TKey,TValue}}, has the default concurrency
level, has the default initial capacity, and uses the default comparer for the key type.
Initializes a new instance of the ConcurrentDictionary<T, U>
class that is empty, has the specified concurrency level and capacity, and uses the specified
IEqualityComparer{TKey}.
public ConcurrentDictionary(IEnumerable<KeyValuePair<TKey, TValue>> collection, IEqualityComparer<TKey> comparer)
Initializes a new instance of the ConcurrentDictionary<T, U>
class that contains elements copied from the specified IEnumerable, has the default concurrency level, has the default
initial capacity, and uses the specified
IEqualityComparer{TKey}.
public ConcurrentDictionary(int concurrencyLevel, IEnumerable<KeyValuePair<TKey, TValue>> collection, IEqualityComparer<TKey> comparer)
Initializes a new instance of the ConcurrentDictionary<T, U>
class that contains elements copied from the specified IEnumerable,
has the specified concurrency level, has the specified initial capacity, and uses the specified
IEqualityComparer{TKey}.
Initializes a new instance of the ConcurrentDictionary<T, U>
class that is empty, has the specified concurrency level, has the specified initial capacity, and
uses the specified IEqualityComparer{TKey}.
public TValue AddOrUpdate(TKey key, Func<TKey, TValue> addValueFactory, Func<TKey, TValue, TValue> updateValueFactory)
Adds a key/value pair to the ConcurrentDictionary<T, U> if the key does not already
exist, or updates a key/value pair in the ConcurrentDictionary<T, U> if the key
already exists.
Adds a key/value pair to the ConcurrentDictionary<T, U> if the key does not already
exist, or updates a key/value pair in the ConcurrentDictionary<T, U> if the key
already exists.
Removes all keys and values from the ConcurrentDictionary<T, U>.
Determines whether the ConcurrentDictionary<T, U> contains the specified
key.
Returns an enumerator that iterates through the ConcurrentDictionary<T, U>.
Adds a key/value pair to the ConcurrentDictionary<T, U>
if the key does not already exist.
Adds a key/value pair to the ConcurrentDictionary<T, U>
if the key does not already exist.
Copies the key and value pairs stored in the ConcurrentDictionary<T, U> to a
new array.
Attempts to add the specified key and value to the ConcurrentDictionary<T, U>.
Attempts to get the value associated with the specified key from the ConcurrentDictionary<T, U>.
Attempts to remove and return the the value with the specified key from the
ConcurrentDictionary<T, U>.
Compares the existing value for the specified key with a specified value, and if they're equal,
updates the key with a third value.