Show / Hide Table of Contents

    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
    Object
    ThreadSafeReference
    ThreadSafeReference.List<T>
    ThreadSafeReference.Object<T>
    ThreadSafeReference.Query<T>
    Inherited Members
    Object.Equals(Object)
    Object.Equals(Object, Object)
    Object.GetHashCode()
    Object.GetType()
    Object.MemberwiseClone()
    Object.ReferenceEquals(Object, Object)
    Object.ToString()
    Namespace:Realms
    Assembly:Realm.dll
    Syntax
    public abstract class ThreadSafeReference
    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 Source

    Create<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 Realm.ResolveReference(ThreadSafeReference.Object) on a different thread.

    Type Parameters
    Name Description
    T

    The type of the RealmObject.

    | Improve this Doc View Source

    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)where T : RealmObject
    Parameters
    Type Name Description
    IList<T> value

    The thread-confined IList<T> to create a thread-safe reference to. It must be a collection representing to-many relationship as a property of a RealmObject

    Returns
    Type Description
    ThreadSafeReference.List<T>

    A ThreadSafeReference that can be passed to Realm.ResolveReference(ThreadSafeReference.List) on a different thread.

    Type Parameters
    Name Description
    T

    The type of the RealmObject contained in the list.

    | Improve this Doc View Source

    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 IQueryable<T> to create a thread-safe reference to. It must be a collection, obtained by calling All(String) or a subsequent LINQ query.

    Returns
    Type Description
    ThreadSafeReference.Query<T>

    A ThreadSafeReference that can be passed to Realm.ResolveReference(ThreadSafeReference.Query) on a different thread.

    Type Parameters
    Name Description
    T

    The type of the RealmObject contained in the query.

    • Improve this Doc
    • View Source
    Back to top Copyright © 2017 Realm
    Generated by DocFX