Class FrozenObjectsExtensions
A set of extension methods on top of RealmObjectBase.
Namespace: Realms
Assembly: Realm.dll
Syntax
public static class FrozenObjectsExtensions
Methods
| Edit this page View SourceFreeze<TValue>(IDictionary<string, TValue>)
Creates a frozen snapshot of this dictionary. The frozen copy can be read from any thread. If the dictionary is
not managed, a Realm
Declaration
public static IDictionary<string, TValue> Freeze<TValue>(this IDictionary<string, TValue> dictionary)
Parameters
Type | Name | Description |
---|---|---|
IDictionary<string, TValue> | dictionary | The dictionary you want to create a frozen copy of. |
Returns
Type | Description |
---|---|
IDictionary<string, TValue> | A frozen copy of this dictionary. |
Type Parameters
Name | Description |
---|---|
TValue | The type of the values stored in the dictionary. |
Freeze<T>(IList<T>)
Creates a frozen snapshot of this list. The frozen copy can be read and iterated over from any thread. If the list is
not managed, a Realm
Declaration
public static IList<T> Freeze<T>(this IList<T> list)
Parameters
Type | Name | Description |
---|---|---|
IList<T> | list | The list you want to create a frozen copy of. |
Returns
Type | Description |
---|---|
IList<T> | A frozen copy of this list. |
Type Parameters
Name | Description |
---|---|
T | Type of the elements in the list. |
Freeze<T>(ISet<T>)
Creates a frozen snapshot of this set. The frozen copy can be read from any thread. If the set is
not managed, a Realm
Declaration
public static ISet<T> Freeze<T>(this ISet<T> set)
Parameters
Type | Name | Description |
---|---|---|
ISet<T> | set | The set you want to create a frozen copy of. |
Returns
Type | Description |
---|---|
ISet<T> | A frozen copy of this set. |
Type Parameters
Name | Description |
---|---|
T | The type of the elements in the set. |
Freeze<T>(IQueryable<T>)
Creates a frozen snapshot of this query. The frozen copy can be read and queried from any thread. If the query is
not managed (i.e. not a result of All<T>() invocation), a Realm
Declaration
public static IQueryable<T> Freeze<T>(this IQueryable<T> query) where T : IRealmObjectBase
Parameters
Type | Name | Description |
---|---|---|
IQueryable<T> | query | The query you want to create a frozen copy of. |
Returns
Type | Description |
---|---|
IQueryable<T> | A frozen copy of this query. |
Type Parameters
Name | Description |
---|---|
T | The type of the elements in the query. |
Freeze<T>(T)
Returns a frozen snapshot of this object. The frozen copy can be read and queried from any thread without throwing an exception.
Freezing a RealmObjectBase also creates a frozen Realm which has its own lifecycle, but if the live Realm that spawned the original object is fully closed (i.e. all instances across all threads are closed), the frozen Realm and object will be closed as well. Frozen objects can be queried as normal, but trying to mutate it in any way or attempting to subscribe for notifications will throw a RealmDeclaration
public static T Freeze<T>(this T realmObj) where T : IRealmObjectBase
Parameters
Type | Name | Description |
---|---|---|
T | realmObj | The IRealm |
Returns
Type | Description |
---|---|
T | A new frozen instance of the passed in object or the object itself if it was already frozen. |
Type Parameters
Name | Description |
---|---|
T | The type of the IRealm |