Note
Do not set this property to , if the number of the possibly added items is not limited.
public bool PreserveMergedItems { get; set; }
Public Property PreserveMergedItems As Boolean
Get
Set
public:
property bool PreserveMergedItems {
bool get ();
void set (bool value);
}
member PreserveMergedItems : bool with get, set
If the possible number of items in this ThreadSafeHashSetT is known to be a limited value, then this property can be set to , so once the items have been merged into the faster lock-free storage, their entry is not removed anymore even if they are deleted. This ensures that removing and re-adding an item again and again remains a lock-free operation.
This property can be set to even if items are never removed so it is not checked before a merge operation whether the amount of deleted items exceeds a specific limit.
If this property is , then the already merged items are not removed even when calling the Clear method. The memory of the deleted entries can be freed by explicitly calling the TrimExcess method, whereas to remove all allocated entries you can call the Reset method.
Even if this property is , the removed items are not dropped immediately. Unused items are removed during a merge operation and only when their number exceeds a specific limit. You can call the TrimExcess method to force removing unused items on demand.