Class CollectionNotificationsExtensions
A set of extensions methods exposing notification-related functionality over collections.
Inherited Members
Namespace:Realms
Assembly:Realm.dll
Syntax
public static class CollectionNotificationsExtensions
Methods
| Improve this Doc View SourceAsRealmCollection<T>(IList<T>)
A convenience method that casts IList<T> to IRealmCollection<T> which implements INotifyCollectionChanged.
Declaration
public static IRealmCollection<T> AsRealmCollection<T>(this IList<T> list)where T : RealmObject
Parameters
Type | Name | Description |
---|---|---|
IList<T> | list | The IList<T> to observe for changes. |
Returns
Type | Description |
---|---|
IRealmCollection<T> | The collection, implementing INotifyCollectionChanged. |
Type Parameters
Name | Description |
---|---|
T | Type of the RealmObject in the list. |
See Also
| Improve this Doc View SourceAsRealmCollection<T>(IQueryable<T>)
A convenience method that casts IQueryable<T> to IRealmCollection<T> which implements INotifyCollectionChanged.
Declaration
public static IRealmCollection<T> AsRealmCollection<T>(this IQueryable<T> results)where T : RealmObject
Parameters
Type | Name | Description |
---|---|---|
IQueryable<T> | results | The IQueryable<T> to observe for changes. |
Returns
Type | Description |
---|---|
IRealmCollection<T> | The collection, implementing INotifyCollectionChanged. |
Type Parameters
Name | Description |
---|---|
T | Type of the RealmObject in the results. |
See Also
| Improve this Doc View SourceMove<T>(IList<T>, T, Int32)
Move the specified item to a new position within the list.
Declaration
public static void Move<T>(this IList<T> list, T item, int index)where T : RealmObject
Parameters
Type | Name | Description |
---|---|---|
IList<T> | list | The list where the move should occur. |
T | item | The item that will be moved. |
Int32 | index | The new position to which the item will be moved. |
Type Parameters
Name | Description |
---|---|
T | Type of the RealmObject in the list. |
Remarks
This extension method will work for standalone lists as well by calling Remove(T) and then Insert(Int32, T).
Exceptions
Type | Condition |
---|---|
ArgumentOutOfRangeException | Thrown if the index is less than 0 or greater than Count - 1. |
SubscribeForNotifications<T>(IList<T>, NotificationCallbackDelegate<T>)
A convenience method that casts IList<T> to IRealmCollection<T> and subscribes for change notifications.
Declaration
public static IDisposable SubscribeForNotifications<T>(this IList<T> results, NotificationCallbackDelegate<T> callback)where T : RealmObject
Parameters
Type | Name | Description |
---|---|---|
IList<T> | results | The IList<T> to observe for changes. |
NotificationCallbackDelegate<T> | callback | The callback to be invoked with the updated IRealmCollection<T>. |
Returns
Type | Description |
---|---|
IDisposable | A subscription token. It must be kept alive for as long as you want to receive change notifications. To stop receiving notifications, call Dispose(). |
Type Parameters
Name | Description |
---|---|
T | Type of the RealmObject in the results. |
See Also
| Improve this Doc View SourceSubscribeForNotifications<T>(IQueryable<T>, NotificationCallbackDelegate<T>)
A convenience method that casts IQueryable<T> to IRealmCollection<T> and subscribes for change notifications.
Declaration
public static IDisposable SubscribeForNotifications<T>(this IQueryable<T> results, NotificationCallbackDelegate<T> callback)where T : RealmObject
Parameters
Type | Name | Description |
---|---|---|
IQueryable<T> | results | The IQueryable<T> to observe for changes. |
NotificationCallbackDelegate<T> | callback | The callback to be invoked with the updated IRealmCollection<T>. |
Returns
Type | Description |
---|---|
IDisposable | A subscription token. It must be kept alive for as long as you want to receive change notifications. To stop receiving notifications, call Dispose(). |
Type Parameters
Name | Description |
---|---|
T | Type of the RealmObject in the results. |
See Also
| Improve this Doc View SourceToNotifyCollectionChanged<T>(IOrderedQueryable<T>, Action<Exception>)
Deprecated A convenience method that casts IQueryable<T> to IRealmCollection<T> which implements INotifyCollectionChanged.
Declaration
[Obsolete("Use .AsRealmCollection to get a collection that implements INotifyCollectionChanged. For error callback, use Realm.Error.")]
public static INotifyCollectionChanged ToNotifyCollectionChanged<T>(this IOrderedQueryable<T> results, Action<Exception> errorCallback)where T : RealmObject
Parameters
Type | Name | Description |
---|---|---|
IOrderedQueryable<T> | results | The IQueryable<T> to observe for changes. |
Action<Exception> | errorCallback | The parameter is not used. |
Returns
Type | Description |
---|---|
INotifyCollectionChanged | The collection, implementing INotifyCollectionChanged. |
Type Parameters
Name | Description |
---|---|
T | Type of the RealmObject in the results. |
See Also
| Improve this Doc View SourceToNotifyCollectionChanged<T>(IOrderedQueryable<T>, Action<Exception>, Boolean)
Deprecated A convenience method that casts IQueryable<T> to IRealmCollection<T> which implements INotifyCollectionChanged.
Declaration
[Obsolete("Use .AsRealmCollection to get a collection that implements INotifyCollectionChanged. For error callback, use Realm.Error.")]
public static INotifyCollectionChanged ToNotifyCollectionChanged<T>(this IOrderedQueryable<T> results, Action<Exception> errorCallback, bool coalesceMultipleChangesIntoReset)where T : RealmObject
Parameters
Type | Name | Description |
---|---|---|
IOrderedQueryable<T> | results | The IQueryable<T> to observe for changes. |
Action<Exception> | errorCallback | The parameter is not used. |
Boolean | coalesceMultipleChangesIntoReset | The parameter is not used. |
Returns
Type | Description |
---|---|
INotifyCollectionChanged | The collection, implementing INotifyCollectionChanged. |
Type Parameters
Name | Description |
---|---|
T | Type of the RealmObject in the results. |