IEnumerableExtensionsToHashSetT Method (IEnumerableT, IEqualityComparerT) |
Creates a HashSet from a sequence. If the sequence is already a HashSet, a new HashSet is still created.
Namespace: Bio.UtilAssembly: Bio.Core (in Bio.Core.dll) Version: 2.0.0.1 (2.0.0.1)
Syntax public static HashSet<T> ToHashSet<T>(
this IEnumerable<T> sequence,
IEqualityComparer<T> comparer
)
<ExtensionAttribute>
Public Shared Function ToHashSet(Of T) (
sequence As IEnumerable(Of T),
comparer As IEqualityComparer(Of T)
) As HashSet(Of T)
public:
[ExtensionAttribute]
generic<typename T>
static HashSet<T>^ ToHashSet(
IEnumerable<T>^ sequence,
IEqualityComparer<T>^ comparer
)
[<ExtensionAttribute>]
static member ToHashSet :
sequence : IEnumerable<'T> *
comparer : IEqualityComparer<'T> -> HashSet<'T>
Parameters
- sequence
- Type: System.Collections.GenericIEnumerableT
the input sequence - comparer
- Type: System.Collections.GenericIEqualityComparerT
The IEqualityComparer used by the HashSet
Type Parameters
- T
- the type of elements of the sequence
Return Value
Type:
HashSetTa HashSet
Usage Note
In Visual Basic and C#, you can call this method as an instance method on any object of type
IEnumerableT. When you use instance method syntax to call this method, omit the first parameter. For more information, see
Extension Methods (Visual Basic) or
Extension Methods (C# Programming Guide).
See Also