Fusion type for networking Dictionaries. Maximum capacity is fixed, and is set with the CapacityAttribute.
.
More...
Inherits .
|
|
bool | Add (K key, V value) |
| | Adds a new key value pair to the Dictionary. If the key already exists, will return false.
|
| void INetworkDictionary. | Add (object item) |
| | Adds an item to the networked dictionary.
|
|
void | Clear () |
| | Remove all entries from the Dictionary, and clear backing memory.
|
|
bool | ContainsKey (K key) |
| | Returns true if the Dictionary contains an entry for the given key.
|
| bool | ContainsValue (V value, IEqualityComparer< V > equalityComparer=null) |
| | Returns true if the Dictionary contains an entry value which compares as equal to given value.
|
|
void | Dispose () |
| | Dispose enumerator.
|
|
V | Get (K key) |
| | Returns the value for the given key. Will throw an error if the key is not found.
|
|
Enumerator | GetEnumerator () |
| | Returns an enumerator that iterates through the NetworkDictionary.
|
|
bool | MoveNext () |
| | Move to next entry in dictionary.
|
|
| NetworkDictionary (int *data, int capacity, IElementReaderWriter< K > keyReaderWriter, IElementReaderWriter< V > valReaderWriter) |
| | NetworkDictionary constructor.
|
| bool | Remove (K key) |
| | Remove entry from Dictionary.
|
| bool | Remove (K key, out V value) |
| | Removes entry from Dictionary. If successful (key existed), returns true and the value of removed item.
|
|
void | Reset () |
| | Reset enumerator.
|
|
V | Set (K key, V value) |
| | Sets the value for the given key. Will add a new key if the key does not already exist.
|
|
KeyValuePair< K, V >[] | ToArray () |
| | Copies all key-value pairs to a new array.
|
|
NetworkDictionaryReadOnly< K, V > | ToReadOnly () |
| | Converts the current NetworkDictionary to a read-only version.
|
| bool | TryGet (K key, out V value) |
| | Attempts to get the value for a given key. If found, returns true.
|
|
|
static implicit | operator NetworkDictionaryReadOnly< K, V > (NetworkDictionary< K, V > value) |
| | Converts the current NetworkDictionary to a read-only version.
|
|
|
const int | META_WORD_COUNT = 3 |
| | Meta word count for NetworkDictionary.
|
|
|
readonly int | Capacity [get] |
| | The maximum number of entries this dictionary may contain.
|
|
readonly int | Count [get] |
| | Current number of key/value entries in the Dictionary.
|
|
readonly KeyValuePair< K, V > | Current [get] |
| | Current key/value pair.
|
|
V | this[K key] [get, set] |
| | Key indexer. Gets/Sets value for specified key.
|
Fusion type for networking Dictionaries. Maximum capacity is fixed, and is set with the CapacityAttribute.
.
Typical Usage:
NetworkDictionary(int *data, int capacity, IElementReaderWriter< K > keyReaderWriter, IElementReaderWriter< V > valReaderWriter)
NetworkDictionary constructor.
Definition NetworkDictionary.cs:534
readonly int Capacity
The maximum number of entries this dictionary may contain.
Definition NetworkDictionary.cs:167
Usage for modifying data:
var dict = syncedDict;
dict.Add(5, 123);
dict[5] = 456;
dict.Remove(5);
- Template Parameters
-
◆ Add()
| void INetworkDictionary. Add |
( |
object | item | ) |
|
Adds an item to the networked dictionary.
- Parameters
-
| item | The item to add to the dictionary. |
Implements INetworkDictionary.
◆ ContainsValue()
| bool ContainsValue |
( |
V | value, |
|
|
IEqualityComparer< V > | equalityComparer = null ) |
Returns true if the Dictionary contains an entry value which compares as equal to given value.
- Parameters
-
| value | The value to compare against. |
| equalityComparer | Specify custom IEqualityComparer to be used for compare. |
◆ Remove() [1/2]
Remove entry from Dictionary.
- Parameters
-
- Returns
- Returns true if key was found.
◆ Remove() [2/2]
| bool Remove |
( |
K | key, |
|
|
out V | value ) |
Removes entry from Dictionary. If successful (key existed), returns true and the value of removed item.
- Parameters
-
| key | The key to remove. |
| value | Returns value of removed item. Returns default value if key did not exist. |
- Returns
- Returns true if key was found.
◆ TryGet()
| bool TryGet |
( |
K | key, |
|
|
out V | value ) |
Attempts to get the value for a given key. If found, returns true.
- Parameters
-
| key | The key to remove. |
| value | Returns value of removed item. Returns default value if key did not exist. |
- Returns
- Returns true if key was found.