ThreadSafeHashSetT(Int32, IEqualityComparerT, HashingStrategy) Constructor

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

Definition

Namespace: KGySoft.Collections
Assembly: KGySoft.CoreLibraries (in KGySoft.CoreLibraries.dll) Version: 8.1.0
C#
public ThreadSafeHashSet(
	int capacity,
	IEqualityComparer<T>? comparer,
	HashingStrategy strategy = HashingStrategy.Auto
)

Parameters

capacity  Int32
Specifies the initial minimum capacity of the internal temporal storage for new items. If 0, then a default capacity is used.
comparer  IEqualityComparerT
The IEqualityComparerT implementation to use when comparing items. If , EnumComparer<TEnum>.Comparer will be used for enum item types when targeting the .NET Framework, and EqualityComparer<T>.Default in other cases. This parameter is optional.
Default value: .
strategy  HashingStrategy  (Optional)
The hashing strategy to be used in the created ThreadSafeHashSetT. This parameter is optional.
Default value: Auto.

Remarks

  Tip

If T 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