Collections Collections
Collections Collections
DocFX + Singulink = ♥

Search Results for

    Method AsTransientReadOnly

    AsTransientReadOnly()

    Returns a fast read-only wrapper around the underlying HashSet<T> that is only guaranteed to be valid until the values associated with Key in Dictionary are modified.

    Declaration
    public ReadOnlyHashSet<TValue> AsTransientReadOnly()
    Returns
    Type Description
    ReadOnlyHashSet<TValue>
    Remarks

    References to transient sets should only be held for as long as a series of multiple consecutive read-only operations need to be performed on them. Once the values associated with Key are modified, the transient set's behavior is undefined and it may contain stale values.

    It is not beneficial to use a transient set for a single read operation, but when multiple read operations need to be done consecutively (including enumerating over multiple values), slight performance gains may be seen from performing them on the transient read-only set instead of directly on the HashSetDictionary<TKey, TValue>.ValueSet or HashSetDictionary<TKey, TValue>.ReadOnlyValueSet, since the transient set does not check if it needs to re-synchronize with the dictionary.

    © Singulink. All rights reserved.