![]() |
ProtonNet Server 1.0
An Open Solution for all your socket or web api needs.
|
Provides a thread-safe dictionary implementation that supports concurrent access to elements in a multi-threaded environment. More...
Public Member Functions | |
void | Add (TKey key, TValue value) |
Adds the specified key and value to the dictionary. | |
void | Add (KeyValuePair< TKey, TValue > item) |
Adds the specified key-value pair to the dictionary. | |
void | Clear () |
Removes all keys and values from the dictionary. | |
bool | Contains (KeyValuePair< TKey, TValue > item) |
Determines whether the dictionary contains the specified key-value pair. | |
bool | ContainsKey (TKey key) |
Determines whether the dictionary contains the specified key. | |
void | CopyTo (KeyValuePair< TKey, TValue >[] array, int arrayIndex) |
Copies the elements of the dictionary to an array, starting at a particular array index. | |
IEnumerator< KeyValuePair< TKey, TValue > > | GetEnumerator () |
Returns an enumerator that iterates through the dictionary. | |
bool | Remove (TKey key) |
Removes the value with the specified key from the dictionary. | |
bool | Remove (KeyValuePair< TKey, TValue > item) |
Removes the specified key-value pair from the dictionary. | |
bool | TryGetValue (TKey key, out TValue value) |
Gets the value associated with the specified key. | |
ThreadSafeDictionary () | |
Initializes a new instance of the ThreadSafeDictionary<TKey, TValue> class. | |
ThreadSafeDictionary (int capacity) | |
Initializes a new instance of the ThreadSafeDictionary<TKey, TValue> class with the specified capacity. | |
ThreadSafeDictionary (IEqualityComparer< TKey > comparer) | |
Initializes a new instance of the ThreadSafeDictionary<TKey, TValue> class with the specified comparer. | |
ThreadSafeDictionary (IDictionary< TKey, TValue > dictionary) | |
Initializes a new instance of the ThreadSafeDictionary<TKey, TValue> class by copying the elements from the specified dictionary. | |
ThreadSafeDictionary (int capacity, IEqualityComparer< TKey > comparer) | |
Initializes a new instance of the ThreadSafeDictionary<TKey, TValue> class with the specified capacity and comparer. | |
ThreadSafeDictionary (IDictionary< TKey, TValue > dictionary, IEqualityComparer< TKey > comparer) | |
Initializes a new instance of the ThreadSafeDictionary<TKey, TValue> class by copying the elements from the specified dictionary and using the specified comparer. | |
Properties | |
IDictionary< TKey, TValue > | originDict [get] |
Stores the underlying dictionary of key-value pairs. | |
TValue | this[TKey key] [get, set] |
Gets or sets the value associated with the specified key. | |
ICollection< TKey > | Keys [get] |
Gets a collection containing the keys in the dictionary. | |
ICollection< TValue > | Values [get] |
Gets a collection containing the values in the dictionary. | |
int | Count [get] |
Gets the number of key/value pairs contained in the dictionary. | |
bool | IsReadOnly [get] |
Gets a value indicating whether the dictionary is read-only. | |
Provides a thread-safe dictionary implementation that supports concurrent access to elements in a multi-threaded environment.
XmobiTea.Collections.Generic.ThreadSafeDictionary< TKey, TValue >.ThreadSafeDictionary | ( | int | capacity | ) |
Initializes a new instance of the ThreadSafeDictionary<TKey, TValue> class with the specified capacity.
capacity | The initial number of elements that the dictionary can contain. |
XmobiTea.Collections.Generic.ThreadSafeDictionary< TKey, TValue >.ThreadSafeDictionary | ( | IEqualityComparer< TKey > | comparer | ) |
Initializes a new instance of the ThreadSafeDictionary<TKey, TValue> class with the specified comparer.
comparer | The IEqualityComparer<TKey> implementation to use when comparing keys, or null to use the default equality comparer for the type of the key. |
XmobiTea.Collections.Generic.ThreadSafeDictionary< TKey, TValue >.ThreadSafeDictionary | ( | IDictionary< TKey, TValue > | dictionary | ) |
Initializes a new instance of the ThreadSafeDictionary<TKey, TValue> class by copying the elements from the specified dictionary.
dictionary | The dictionary whose elements are copied to the new dictionary. |
XmobiTea.Collections.Generic.ThreadSafeDictionary< TKey, TValue >.ThreadSafeDictionary | ( | int | capacity, |
IEqualityComparer< TKey > | comparer ) |
Initializes a new instance of the ThreadSafeDictionary<TKey, TValue> class with the specified capacity and comparer.
capacity | The initial number of elements that the dictionary can contain. |
comparer | The IEqualityComparer<TKey> implementation to use when comparing keys, or null to use the default equality comparer for the type of the key. |
XmobiTea.Collections.Generic.ThreadSafeDictionary< TKey, TValue >.ThreadSafeDictionary | ( | IDictionary< TKey, TValue > | dictionary, |
IEqualityComparer< TKey > | comparer ) |
Initializes a new instance of the ThreadSafeDictionary<TKey, TValue> class by copying the elements from the specified dictionary and using the specified comparer.
dictionary | The dictionary whose elements are copied to the new dictionary. |
comparer | The IEqualityComparer<TKey> implementation to use when comparing keys, or null to use the default equality comparer for the type of the key. |
void XmobiTea.Collections.Generic.ThreadSafeDictionary< TKey, TValue >.Add | ( | KeyValuePair< TKey, TValue > | item | ) |
Adds the specified key-value pair to the dictionary.
item | The key-value pair to add to the dictionary. |
void XmobiTea.Collections.Generic.ThreadSafeDictionary< TKey, TValue >.Add | ( | TKey | key, |
TValue | value ) |
Adds the specified key and value to the dictionary.
key | The key of the element to add. |
value | The value of the element to add. |
bool XmobiTea.Collections.Generic.ThreadSafeDictionary< TKey, TValue >.Contains | ( | KeyValuePair< TKey, TValue > | item | ) |
Determines whether the dictionary contains the specified key-value pair.
item | The key-value pair to locate in the dictionary. |
bool XmobiTea.Collections.Generic.ThreadSafeDictionary< TKey, TValue >.ContainsKey | ( | TKey | key | ) |
Determines whether the dictionary contains the specified key.
key | The key to locate in the dictionary. |
void XmobiTea.Collections.Generic.ThreadSafeDictionary< TKey, TValue >.CopyTo | ( | KeyValuePair< TKey, TValue >[] | array, |
int | arrayIndex ) |
Copies the elements of the dictionary to an array, starting at a particular array index.
array | The one-dimensional array that is the destination of the elements copied from the dictionary. |
arrayIndex | The zero-based index in the array at which copying begins. |
IEnumerator< KeyValuePair< TKey, TValue > > XmobiTea.Collections.Generic.ThreadSafeDictionary< TKey, TValue >.GetEnumerator | ( | ) |
Returns an enumerator that iterates through the dictionary.
bool XmobiTea.Collections.Generic.ThreadSafeDictionary< TKey, TValue >.Remove | ( | KeyValuePair< TKey, TValue > | item | ) |
Removes the specified key-value pair from the dictionary.
item | The key-value pair to remove from the dictionary. |
bool XmobiTea.Collections.Generic.ThreadSafeDictionary< TKey, TValue >.Remove | ( | TKey | key | ) |
Removes the value with the specified key from the dictionary.
key | The key of the element to remove. |
bool XmobiTea.Collections.Generic.ThreadSafeDictionary< TKey, TValue >.TryGetValue | ( | TKey | key, |
out TValue | value ) |
Gets the value associated with the specified key.
key | The key whose value to get. |
value | When this method returns, contains the value associated with the specified key, if the key is found; otherwise, the default value for the type of the value parameter. |
|
getset |
Gets or sets the value associated with the specified key.
key | The key whose value is to be accessed or modified. |