# Serialization::RealtimeSet

RealtimeSet is a special model type that can be used in your own custom models. It represents an unordered collection of models. Internally this is used for things like keeping track of all RealtimeViews in the scene. If order is not important, this collection is the recommended collection to use for storing collections of models.

Adding or removing items sends the minimal amount of information to the server in order to perform the update on all clients. The whole collection is not sent every time.

Properties

int Count

int Normal.Realtime.Serialization.RealtimeSet< TValue >.Count

The total number of items in the RealtimeSet, including the items that have been added locally and have yet to be confirmed by the server.

Methods

bool Add (TValue value)

bool Normal.Realtime.Serialization.RealtimeSet< TValue >.Add

Adds a model to the RealtimeSet. This method will immediately fire a modelAdded event. If the add operation is rejected by the server (due to this client not having permissions to edit this model), a modelRemoved event will fire when the server’s response is received.

uint GetCollectionTypeID ()

uint Normal.Realtime.Serialization.RealtimeSet< TValue >.GetCollectionTypeID

IEnumerator<TValue> GetEnumerator ()

IEnumerator<TValue> Normal.Realtime.Serialization.RealtimeSet< TValue >.GetEnumerator

delegate void ModelAdded (RealtimeSet< TValue > set, TValue model, bool remote)

delegate void Normal.Realtime.Serialization.RealtimeSet< TValue >.ModelAdded

delegate void ModelRemoved (RealtimeSet< TValue > set, TValue model, bool remote)

delegate void Normal.Realtime.Serialization.RealtimeSet< TValue >.ModelRemoved

void Read (ReadStream stream, StreamContext context)

void Normal.Realtime.Serialization.RealtimeSet< TValue >.Read

RealtimeSet ()

Normal.Realtime.Serialization.RealtimeSet< TValue >.RealtimeSet

bool Remove (TValue value)

bool Normal.Realtime.Serialization.RealtimeSet< TValue >.Remove

Removes a model from the RealtimeSet. This method will immediately fire a modelRemoved event. If the remove operation is rejected by the server (due to this client not having permissions to edit this model), a modelAdded event will fire when the server’s response is received.

void Write (WriteStream stream, StreamContext context)

void Normal.Realtime.Serialization.RealtimeSet< TValue >.Write

int WriteLength (StreamContext context)

int Normal.Realtime.Serialization.RealtimeSet< TValue >.WriteLength

Events

ModelAdded modelAdded

ModelAdded Normal.Realtime.Serialization.RealtimeSet< TValue >.modelAdded

The total number of items in the RealtimeSet, including the items that have been added locally and have yet to be confirmed by the server.

ModelRemoved modelRemoved

ModelRemoved Normal.Realtime.Serialization.RealtimeSet< TValue >.modelRemoved

An event that fires whenever an item is removed. This event includes a boolean to signal whether the model was added by the local client or a remote client.