Class ConcurrentDictionary<TKey, TValue>
Represents a concurrent (thread-safe) Dictionary.
Inherited Members
Namespace: TriLibCore.General
Assembly: TriLibCore.dll
Syntax
public class ConcurrentDictionary<TKey, TValue> : IEnumerable<KeyValuePair<TKey, TValue>>, IEnumerable
Type Parameters
Name | Description |
---|---|
TKey | The type of the t key. |
TValue | The type of the t value. |
Constructors
ConcurrentDictionary()
Declaration
public ConcurrentDictionary()
Properties
Count
Gets the Dicitionary item count.
Declaration
public int Count { get; }
Property Value
Type | Description |
---|---|
int |
this[TKey]
Gets or sets the TValue with the specified key.
Declaration
public TValue this[TKey key] { get; set; }
Parameters
Type | Name | Description |
---|---|---|
TKey | key | The key. |
Property Value
Type | Description |
---|---|
TValue | TValue. |
Keys
Gets the Dictionary Keys.
Declaration
public Dictionary<TKey, TValue>.KeyCollection Keys { get; }
Property Value
Type | Description |
---|---|
Dictionary<TKey, TValue>.KeyCollection |
Values
Gets the Dictionary Values.
Declaration
public Dictionary<TKey, TValue>.ValueCollection Values { get; }
Property Value
Type | Description |
---|---|
Dictionary<TKey, TValue>.ValueCollection |
Methods
Add(TKey, TValue)
Adds the specified key to the Dictionary.
Declaration
public void Add(TKey key, TValue val)
Parameters
Type | Name | Description |
---|---|---|
TKey | key | The Key to add. |
TValue | val | The value to add. |
ContainsKey(TKey)
Determines whether this Dictionary contains the given Key.
Declaration
public bool ContainsKey(TKey id)
Parameters
Type | Name | Description |
---|---|---|
TKey | id | The Key value. |
Returns
Type | Description |
---|---|
bool |
|
OrderBy(Func<KeyValuePair<TKey, TValue>, TKey>)
Orders the Dictionary using the given callback.
Declaration
public List<KeyValuePair<TKey, TValue>> OrderBy(Func<KeyValuePair<TKey, TValue>, TKey> func)
Parameters
Type | Name | Description |
---|---|---|
Func<KeyValuePair<TKey, TValue>, TKey> | func | The OrderBy callback Method. |
Returns
Type | Description |
---|---|
List<KeyValuePair<TKey, TValue>> | List<KeyValuePair<TKey, TValue>>. |
TryAdd(TKey, TValue)
Tries to add a Value to the Dictionary using the given Key
Declaration
public bool TryAdd(TKey key, TValue value)
Parameters
Type | Name | Description |
---|---|---|
TKey | key | The Key to try to add. |
TValue | value | The value to try to add. |
Returns
Type | Description |
---|---|
bool |
|
TryGetValue(TKey, out TValue)
Tries to get the value from the given Key on the Dictionary.
Declaration
public bool TryGetValue(TKey key, out TValue value)
Parameters
Type | Name | Description |
---|---|---|
TKey | key | The Key to look for. |
TValue | value | The value, if found. |
Returns
Type | Description |
---|---|
bool |
|
TryRemove(TKey)
Tries to remove the given Item from the Dictionary.
Declaration
public bool TryRemove(TKey key)
Parameters
Type | Name | Description |
---|---|---|
TKey | key | The Key to try to remove. |
Returns
Type | Description |
---|---|
bool |
|