Method TryUpdate
TryUpdate(TKey, TValue)
Updates an element with the provided key to the value if it exists.
Declaration
public bool TryUpdate(TKey key, TValue value)
Parameters
Type | Name | Description |
---|---|---|
TKey | key | The object to use as the key of the element to update. |
TValue | value | The new value for the key if found. |
Returns
Type | Description |
---|---|
System.Boolean | Returns true if the key provided was found and updated to the value. |
TryUpdate(TKey, TValue, TValue)
Updates an element with the provided key to the value if it exists.
Declaration
public bool TryUpdate(TKey key, TValue value, TValue comparisonValue)
Parameters
Type | Name | Description |
---|---|---|
TKey | key | The object to use as the key of the element to update. |
TValue | value | The new value for the key if found. |
TValue | comparisonValue | The value that is compared to the value of the element with key. |
Returns
Type | Description |
---|---|
System.Boolean | Returns true if the key provided was found and updated to the value. |
TryUpdate(TKey, KeyValueUpdate<TKey, TValue>)
Modify the value associated with the result of the provided update method as an atomic operation, Allows for reading/writing a single record within the syncronization lock.
Declaration
public bool TryUpdate(TKey key, KeyValueUpdate<TKey, TValue> fnUpdate)
Parameters
Type | Name | Description |
---|---|---|
TKey | key | |
KeyValueUpdate<TKey, TValue> | fnUpdate |
Returns
Type | Description |
---|---|
System.Boolean |