StringKeyDictionary<TValue>
Events
event DidInsertModelForKey<TValue> didInsertModelForKey
An event that fires when a model is successfully added to the collection by any client.
event DidRemoveModelForKey<TValue> didRemoveModelForKey
An event that fires when a model is successfully removed from the collection by any client.
event DidClearAllModels<TValue> didClearAllModels
An event that fires when the collection is cleared by any client.
Properties
TValue Item { get; }
Retrieve a model given a specific key.
- key: The key of the model to retrieve
int Count { get; }
The number of models currently stored in the collection.
Methods
void Insert(string key, TValue value, Action<bool> completionHandler)
Insert a model into the collection. The model will not be inserted until the server confirms the transaction.
- key: The key to use to store the model.
- value: The model to store in the collection. This value cannot be null.
- completionHandler: A completion handler that fires when the operation is complete along with a boolean to indicate if the transaction was successful.
void Remove(string key, Action<bool> completionHandler)
Remove a model from the collection. The model will not be removed until the server confirms the transaction.
- key: The key of the model to remove.
- completionHandler: A completion handler that fires when the operation is complete along with a boolean to indicate if the transaction was successful.
void Clear(Action<bool> completionHandler)
Clear all models from the collection. Models will not be removed until the server confirms the transaction.
This operation will be rejected if any keys have been modified before the clear operation reaches the server.
- completionHandler: A completion handler that fires when the operation is complete along with a boolean to indicate if the transaction was successful.
bool TryGetValue(string 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(string 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 ContainsValue(TValue value)
Check if a model instance is contained in the collection.
This method has equivalent performance to Dictionary<T, V>.ContainsValue().
A boolean indicating whether the value was found within the collection.
- value: The RealtimeModel instance to look for.
IEnumerator<KeyValuePair<string, TValue>> GetEnumerator()
uint GetCollectionTypeID()
← Room [RealtimeModel] →