Realm Xamarin  v0.81.0
Realm for Xamarin
Public Member Functions | Properties | List of all members
Realms.IRealmCollection< out out T > Interface Template Reference

Iterable, sortable collection of one kind of RealmObject resulting from Realm.All or from a LINQ query expression. More...

Inherits IReadOnlyList< T >, INotifyCollectionChanged, and INotifyPropertyChanged.

Public Member Functions

IDisposable SubscribeForNotifications (NotificationCallbackDelegate< T > callback)
 Register a callback to be invoked each time this IRealmCollection<T> changes. More...
 

Properties

Schema.ObjectSchema ObjectSchema [get]
 Gets the object schema of the contained objects. More...
 

Detailed Description

Iterable, sortable collection of one kind of RealmObject resulting from Realm.All or from a LINQ query expression.

Template Parameters
TType of the RealmObject which is being returned.

Member Function Documentation

§ SubscribeForNotifications()

IDisposable Realms.IRealmCollection< out out T >.SubscribeForNotifications ( NotificationCallbackDelegate< T >  callback)

Register a callback to be invoked each time this IRealmCollection<T> changes.

The callback will be asynchronously invoked with the initial IRealmCollection<T>, and then called again after each write transaction which changes either any of the objects in the collection, or which objects are in the collection. The changes parameter will be null the first time the callback is invoked with the initial results. For each call after that, it will contain information about which rows in the results were added, removed or modified.

If a write transaction did not modify any objects in this IRealmCollection<T>, the callback is not invoked at all. If an error occurs the callback will be invoked with null for the sender parameter and a non-null error. Currently the only errors that can occur are when opening the Realms.Realm on the background worker thread.

At the time when the block is called, the IRealmCollection<T> object will be fully evaluated and up-to-date, and as long as you do not perform a write transaction on the same thread or explicitly call Realm.Refresh, accessing it will never perform blocking work.

Notifications are delivered via the standard event loop, and so can't be delivered while the event loop is blocked by other activity. When notifications can't be delivered instantly, multiple notifications may be coalesced into a single notification. This can include the notification with the initial collection.

Parameters
callbackThe callback to be invoked with the updated IRealmCollection<T>.
Returns
A subscription token. It must be kept alive for as long as you want to receive change notifications. To stop receiving notifications, call IDisposable.Dispose.

Property Documentation

§ ObjectSchema

Schema.ObjectSchema Realms.IRealmCollection< out out T >.ObjectSchema
get

Gets the object schema of the contained objects.