Wraps a Dictionary to make all read/write operations thread safe. More...
Public Member Functions | |
| delegate Value | Factory () |
| Factory delegate for creating a Value . More... | |
| delegate bool | ForEachCallback (KeyValuePair< Key, Value > pair) |
| For each callback. More... | |
| Value | Get (Key k, Value defaultValue=default(Value)) |
| Gets the value for a key. More... | |
| bool | TryGetValue (Key k, out Value outValue) |
| Tries to get the value for a key. More... | |
| bool | TryAdd (Key k, Value value) |
| Tries to add the specified key and value to the dictionary. More... | |
| bool | GetOrAddValue (Key key, Factory factory, out Value value) |
| Gets the value of a key from the dictionary. More... | |
| void | Clear () |
| Removes everything from the dictionary. More... | |
| bool | Remove (Key k) |
| Removes a key/value pair from the dictionary. More... | |
| bool | Remove (Key k, Value v) |
| Removes a key/value pair from the dictionary if the value for the key matches the given value. More... | |
| bool | TryRemove (Key k, out Value outValue) |
| Tries to remove and return the value that has the specified key from the dictionary. More... | |
| bool | ContainsKey (Key k) |
| Checks if a key is in the dictionary. More... | |
| void | ForEach (ForEachCallback callback) |
| Call a delegate function on each pair in the dictionary. More... | |
| void | ForEachThenClear (ForEachCallback callback) |
| Call a delegate function on each pair in the dictionary and then remove the pair if the callback returns true. More... | |
Properties | |
| Value | this[Key k] [get, set] |
| Gets/Sets the value for a key. More... | |
| Key[] | Keys [get] |
| Gets a collection of all keys. More... | |
| Value[] | Values [get] |
| Gets a collection of all values. More... | |
Wraps a Dictionary to make all read/write operations thread safe.
| Key | |
| Value |
| void KS.Reactor.ksAtomicDictionary< Key, Value >.Clear | ( | ) |
Removes everything from the dictionary.
| bool KS.Reactor.ksAtomicDictionary< Key, Value >.ContainsKey | ( | Key | k | ) |
Checks if a key is in the dictionary.
| k | Key to check. |
| delegate Value KS.Reactor.ksAtomicDictionary< Key, Value >.Factory | ( | ) |
Factory delegate for creating a Value .
| void KS.Reactor.ksAtomicDictionary< Key, Value >.ForEach | ( | ForEachCallback | callback | ) |
Call a delegate function on each pair in the dictionary.
| callback |
| delegate bool KS.Reactor.ksAtomicDictionary< Key, Value >.ForEachCallback | ( | KeyValuePair< Key, Value > | pair | ) |
For each callback.
| pair | Pair being iterated |
| void KS.Reactor.ksAtomicDictionary< Key, Value >.ForEachThenClear | ( | ForEachCallback | callback | ) |
Call a delegate function on each pair in the dictionary and then remove the pair if the callback returns true.
| callback |
| Value KS.Reactor.ksAtomicDictionary< Key, Value >.Get | ( | Key | k, |
| Value | defaultValue = default(Value) |
||
| ) |
Gets the value for a key.
| k | Key to get value for. |
| defaultValue | Default value to return if the key is not in the dictionary. |
| bool KS.Reactor.ksAtomicDictionary< Key, Value >.GetOrAddValue | ( | Key | key, |
| Factory | factory, | ||
| out Value | value | ||
| ) |
Gets the value of a key from the dictionary.
Creates a new value for the key by calling a factory and adds it to the dictionary if the key was not found.
| key | Key to get value for. |
| factory | Factory for creating the value if the key was not found. |
| value | The value for the key |
| bool KS.Reactor.ksAtomicDictionary< Key, Value >.Remove | ( | Key | k | ) |
Removes a key/value pair from the dictionary.
| k | Key to remove. |
| bool KS.Reactor.ksAtomicDictionary< Key, Value >.Remove | ( | Key | k, |
| Value | v | ||
| ) |
Removes a key/value pair from the dictionary if the value for the key matches the given value.
| k | Key to remove. |
| v | The key/value pair will only be removed if the value for the key matches this. |
| bool KS.Reactor.ksAtomicDictionary< Key, Value >.TryAdd | ( | Key | k, |
| Value | value | ||
| ) |
Tries to add the specified key and value to the dictionary.
| k | Key to add. |
| value | Value to add. |
| bool KS.Reactor.ksAtomicDictionary< Key, Value >.TryGetValue | ( | Key | k, |
| out Value | outValue | ||
| ) |
Tries to get the value for a key.
| k | Key to get value for. |
| outValue | Out value. |
| bool KS.Reactor.ksAtomicDictionary< Key, Value >.TryRemove | ( | Key | k, |
| out Value | outValue | ||
| ) |
Tries to remove and return the value that has the specified key from the dictionary.
| k | Key to get value for. |
| outValue | The object removed from the dictionary, or the default value of the TValue type if key does not exist. |
|
get |
Gets a collection of all keys.
|
getset |
Gets/Sets the value for a key.
| k | Key. |
|
get |
Gets a collection of all values.