ThreadSafeDictionaryTKey, TValueClear Method

Removes all items from the ThreadSafeDictionaryTKey, TValue.

Definition

Namespace: KGySoft.Collections
Assembly: KGySoft.CoreLibraries (in KGySoft.CoreLibraries.dll) Version: 10.0.0
C#
public void Clear()

Implements

ICollectionTClear
IDictionaryClear

Remarks

If PreserveMergedKeys is , or when the amount of removed items does not exceed a limit, then this method is an O(n) operation where n is the number of elements present in the inner lock-free storage. Otherwise, this method calls the Reset method, which frees up all the allocated entries.

  Note

Note that if PreserveMergedKeys is , then though this method removes all values from the ThreadSafeDictionaryTKey, TValue, it never removes the keys that are already merged into the faster lock-free storage. This ensures that adding a new value with an already used key will always be a fast, lock-free operation. To remove all keys and values use the Reset method instead.

See Also