Enumerable.ToHashSet Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Overloads
| Name | Description |
|---|---|
|
ToHashSet |
Creates a HashSet |
|
ToHashSet |
Creates a HashSet |
ToHashSet(IEnumerable)
- Source:
- ToCollection.cs
- Source:
- ToCollection.cs
- Source:
- ToCollection.cs
- Source:
- ToCollection.cs
- Source:
- ToCollection.cs
Creates a HashSet
public:
generic
[System::Runtime::CompilerServices::Extension]
static System::Collections::Generic::HashSet ^ ToHashSet(System::Collections::Generic::IEnumerable ^ source);
public static System.Collections.Generic.HashSet ToHashSet(this System.Collections.Generic.IEnumerable source);
static member ToHashSet : seq<'Source> -> System.Collections.Generic.HashSet<'Source>
Public Function ToHashSet(Of TSource) (source As IEnumerable(Of TSource)) As HashSet(Of TSource)
Type Parameters
- TSource
The type of the elements of source.
Parameters
- source
-
IEnumerable
An IEnumerable
Returns
A HashSetTSource selected from the input sequence.
Exceptions
source is null.
See also
Applies to
ToHashSet(IEnumerable, IEqualityComparer)
- Source:
- ToCollection.cs
- Source:
- ToCollection.cs
- Source:
- ToCollection.cs
- Source:
- ToCollection.cs
- Source:
- ToCollection.cs
Creates a HashSetcomparer to compare keys.
public:
generic
[System::Runtime::CompilerServices::Extension]
static System::Collections::Generic::HashSet ^ ToHashSet(System::Collections::Generic::IEnumerable ^ source, System::Collections::Generic::IEqualityComparer ^ comparer);
public static System.Collections.Generic.HashSet ToHashSet(this System.Collections.Generic.IEnumerable source, System.Collections.Generic.IEqualityComparer? comparer);
public static System.Collections.Generic.HashSet ToHashSet(this System.Collections.Generic.IEnumerable source, System.Collections.Generic.IEqualityComparer comparer);
static member ToHashSet : seq<'Source> * System.Collections.Generic.IEqualityComparer<'Source> -> System.Collections.Generic.HashSet<'Source>
Public Function ToHashSet(Of TSource) (source As IEnumerable(Of TSource), comparer As IEqualityComparer(Of TSource)) As HashSet(Of TSource)
Type Parameters
- TSource
The type of the elements of source.
Parameters
- source
-
IEnumerable
An IEnumerable
- comparer
-
IEqualityComparer
An IEqualityComparer
Returns
A HashSetTSource selected from the input sequence.
Exceptions
source is null.