Property UnsafeCount
UnsafeCount
Gets the number of entries in the internal data structure. This value will be higher than the actual number of values in the collection if any of the values were garbage collected but still have internal entries in the collection that have not been cleaned.
Declaration
public int UnsafeCount { get; }
Property Value
Type |
---|
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>) so that they can't be garbage collected and use that to get the count and access the values.