Collections Collections
Collections Collections
DocFX + Singulink = ♥

Search Results for

    Property UnsafeCount

    UnsafeCount

    Gets the number of entries in the internal data structure. This value will be different than the actual count if any of the values were garbage collected but still have internal entries in the dictionary that have not been cleaned.

    Declaration
    public int UnsafeCount { get; }
    Property Value
    Type Description
    int
    Remarks

    This count will not be accurate if values have been collected since the last clean. You can call Clean() to force a full sweep before reading the count to get a more accurate value, but keep in mind that a subsequent enumeration may still return fewer values if they happen to get garbage collected before or during the enumeration. If you require an accurate count together with all the values then you should temporarily copy the values into a strongly referenced collection (like a List<T> or Dictionary<TKey, TValue>) so that they can't be garbage collected and use that to get the count and access the values.

    © Singulink. All rights reserved.