Class ThreadSafeReference
An object intended to be passed between threads containing a thread-safe reference to its thread-confined object.
To resolve a thread-safe reference on a target Realm on a different thread, pass it to
Realm.ResolveReference
.
Inheritance
Namespace: Realms
Assembly: Realm.dll
Syntax
public abstract class ThreadSafeReference : object
Remarks
A ThreadSafeReference object must be resolved at most once.
Failing to resolve a ThreadSafeReference will result in the source version of the Realm being pinned until the reference is deallocated.
Prefer short-lived ThreadSafeReferences as the data for the version of the source Realm will be retained until all references have been resolved or deallocated.
Methods
| Improve this Doc View SourceCreate<T>(T)
Initializes a new instance of the ThreadSafeReference.Object<T> class.
Declaration
public static ThreadSafeReference.Object<T> Create<T>(T value)
where T : RealmObject
Parameters
Type | Name | Description |
---|---|---|
T | value | The thread-confined RealmObject to create a thread-safe reference to. |
Returns
Type | Description |
---|---|
ThreadSafeReference.Object<T> | A ThreadSafeReference that can be passed to |
Type Parameters
Name | Description |
---|---|
T | The type of the RealmObject. |
Create<T>(IList<T>)
Initializes a new instance of the ThreadSafeReference.List<T> class.
Declaration
public static ThreadSafeReference.List<T> Create<T>(IList<T> value)
Parameters
Type | Name | Description |
---|---|---|
IList<T> | value | The thread-confined |
Returns
Type | Description |
---|---|
ThreadSafeReference.List<T> | A ThreadSafeReference that can be passed to |
Type Parameters
Name | Description |
---|---|
T | The type of the objects contained in the list. |
Create<T>(IQueryable<T>)
Initializes a new instance of the ThreadSafeReference.Query<T> class.
Declaration
public static ThreadSafeReference.Query<T> Create<T>(IQueryable<T> value)
where T : RealmObject
Parameters
Type | Name | Description |
---|---|---|
IQueryable<T> | value | The thread-confined |
Returns
Type | Description |
---|---|
ThreadSafeReference.Query<T> | A ThreadSafeReference that can be passed to |
Type Parameters
Name | Description |
---|---|
T | The type of the RealmObject contained in the query. |