RealtimeDictionary<TValue>
Events
event ModelAdded<TValue> modelAdded
An event that fires when a model is added locally or remotely.
event ModelReplaced<TValue> modelReplaced
An event that fires when a model is replaced locally or remotely.
A model is considered replaced (as opposed to removed and added) if a new model is added that overwrites an existing model under the same key.
event ModelRemoved<TValue> modelRemoved
An event that fires when a model is removed locally or remotely.
Properties
TValue Item { get; set; }
Access a model for a specific key.
- key: The key of the model.
int Count { get; }
The number of models currently stored in the collection.
Methods
void Add(uint key, TValue value)
Add a model to the collection.
- key: The key to store the model under
- value: The model to store in the collection
bool Remove(uint key)
Remove a model from the collection.
A boolean to indicate whether the key was contained within the collection.
- key: The key of the model to remove
IEnumerator<KeyValuePair<uint, TValue>> GetEnumerator()
bool TryGetValue(uint key, TValue& value)
Attempt to retrieve a value from the collection.
This method will not throw an exception if the key is not found.
A boolean indicating whether the key was found within the collection.
- key: The key of the model to fetch.
- value: The model if one is found, otherwise null.
bool ContainsKey(uint key)
Check if a key exists within the collection.
A boolean indicating whether the key was found within the collection.
- key: The key to search for.
bool Contains(TValue value)
Check if a model instance is contained in the collection.
This method is very slow! If you need high performance value searching, you should use the added/replaced/removed events to mirror this collection to a faster collection type.
A boolean indicating whether the value was found within the collection.
- value: The model instance to look for.
uint GetCollectionTypeID()