ThreadSafeDictionaryTKey, TValue(IEqualityComparerTKey, HashingStrategy) Constructor

Initializes a new instance of the ThreadSafeDictionaryTKey, TValue class that is empty and uses the specified comparer and hashing strategy.

Definition

Namespace: KGySoft.Collections
Assembly: KGySoft.CoreLibraries (in KGySoft.CoreLibraries.dll) Version: 10.0.0
C#
public ThreadSafeDictionary(
	IEqualityComparer<TKey>? comparer,
	HashingStrategy strategy = HashingStrategy.Auto
)

Parameters

comparer  IEqualityComparerTKey
The IEqualityComparerT implementation to use when comparing keys. If , EnumComparer<TEnum>.Comparer will be used for enum key types when targeting the .NET Framework, and EqualityComparer<T>.Default in other cases.
strategy  HashingStrategy  (Optional)
The hashing strategy to be used in the created ThreadSafeDictionaryTKey, TValue. This parameter is optional.
Default value: Auto.

Remarks

  Tip

If TKey is string and it is safe to use a non-randomized string comparer, then you can pass StringSegmentComparer.Ordinal to the comparer parameter for better performance.

See Also