Search Results for

    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.Dictionary<TValue>
    ThreadSafeReference.List<T>
    ThreadSafeReference.Object<T>
    ThreadSafeReference.Query<T>
    ThreadSafeReference.Set<T>
    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 : IRealmObjectBase
    Parameters
    Type Name Description
    T value

    The thread-confined RealmObject or EmbeddedObject to create a thread-safe reference to.

    Returns
    Type Description
    ThreadSafeReference.Object<T>

    A ThreadSafeReference that can be passed to ResolveReference<T>(ThreadSafeReference.Object<T>) on a different thread.

    Type Parameters
    Name Description
    T

    The type of the RealmObject/EmbeddedObject.

    | Improve this Doc View Source

    Create<TValue>(IDictionary<String, TValue>)

    Initializes a new instance of the ThreadSafeReference.Dictionary<TValue> class.

    Declaration
    public static ThreadSafeReference.Dictionary<TValue> Create<TValue>(IDictionary<string, TValue> value)
    Parameters
    Type Name Description
    IDictionary<String, TValue> value

    The thread-confined IDictionary<TKey,TValue> to create a thread-safe reference to. It must be a collection that is a managed property of a RealmObject or an EmbeddedObject.

    Returns
    Type Description
    ThreadSafeReference.Dictionary<TValue>

    A ThreadSafeReference that can be passed to ResolveReference<TValue>(ThreadSafeReference.Dictionary<TValue>) on a different thread.

    Type Parameters
    Name Description
    TValue

    The type of the values contained in the dictionary.

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

    The thread-confined IList<T> to create a thread-safe reference to. It must be a collection that is a managed property of a RealmObject or an EmbeddedObject.

    Returns
    Type Description
    ThreadSafeReference.List<T>

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

    Type Parameters
    Name Description
    T

    The type of the objects contained in the list.

    | Improve this Doc View Source

    Create<T>(ISet<T>)

    Initializes a new instance of the ThreadSafeReference.Set<T> class.

    Declaration
    public static ThreadSafeReference.Set<T> Create<T>(ISet<T> value)
    Parameters
    Type Name Description
    ISet<T> value

    The thread-confined ISet<T> to create a thread-safe reference to. It must be a collection that is a managed property of a RealmObject or an EmbeddedObject.

    Returns
    Type Description
    ThreadSafeReference.Set<T>

    A ThreadSafeReference that can be passed to ResolveReference<T>(ThreadSafeReference.Set<T>) on a different thread.

    Type Parameters
    Name Description
    T

    The type of the objects contained in the set.

    | 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)
    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<T>() or a subsequent LINQ query.

    Returns
    Type Description
    ThreadSafeReference.Query<T>

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

    Type Parameters
    Name Description
    T

    The type of the RealmObject or EmbeddedObject contained in the query.

    • Improve this Doc
    • View Source
    In This Article
    Back to top Copyright © 2020 Realm
    Generated by DocFX