Enumerable.ToHashSet Metod

Definition

Överlagringar

Name Description
ToHashSet<TSource>(IEnumerable<TSource>, IEqualityComparer<TSource>)

Skapar en HashSet<T> från en IEnumerable<T> med hjälp av comparer för att jämföra nycklar.

ToHashSet<TSource>(IEnumerable<TSource>)

Skapar en HashSet<T> från en IEnumerable<T>.

ToHashSet<TSource>(IEnumerable<TSource>, IEqualityComparer<TSource>)

Skapar en HashSet<T> från en IEnumerable<T> med hjälp av comparer för att jämföra nycklar.

public:
generic <typename TSource>
[System::Runtime::CompilerServices::Extension]
 static System::Collections::Generic::HashSet<TSource> ^ ToHashSet(System::Collections::Generic::IEnumerable<TSource> ^ source, System::Collections::Generic::IEqualityComparer<TSource> ^ comparer);
public static System.Collections.Generic.HashSet<TSource> ToHashSet<TSource>(this System.Collections.Generic.IEnumerable<TSource> source, System.Collections.Generic.IEqualityComparer<TSource> comparer);
static member ToHashSet : seq<'Source> * System.Collections.Generic.IEqualityComparer<'Source> -> System.Collections.Generic.HashSet<'Source>
<Extension()>
Public Function ToHashSet(Of TSource) (source As IEnumerable(Of TSource), comparer As IEqualityComparer(Of TSource)) As HashSet(Of TSource)

Typparametrar

TSource

Typen av element sourcei .

Parametrar

source
IEnumerable<TSource>

En IEnumerable<T> att skapa en HashSet<T> från.

comparer
IEqualityComparer<TSource>

En IEqualityComparer<T> för att jämföra nycklar.

Returer

HashSet<TSource>

En HashSet<T> som innehåller värden av den typ TSource som valts från indatasekvensen.

Undantag

source är null.

Se även

Gäller för

ToHashSet<TSource>(IEnumerable<TSource>)

Skapar en HashSet<T> från en IEnumerable<T>.

public:
generic <typename TSource>
[System::Runtime::CompilerServices::Extension]
 static System::Collections::Generic::HashSet<TSource> ^ ToHashSet(System::Collections::Generic::IEnumerable<TSource> ^ source);
public static System.Collections.Generic.HashSet<TSource> ToHashSet<TSource>(this System.Collections.Generic.IEnumerable<TSource> source);
static member ToHashSet : seq<'Source> -> System.Collections.Generic.HashSet<'Source>
<Extension()>
Public Function ToHashSet(Of TSource) (source As IEnumerable(Of TSource)) As HashSet(Of TSource)

Typparametrar

TSource

Typen av element sourcei .

Parametrar

source
IEnumerable<TSource>

En IEnumerable<T> att skapa en HashSet<T> från.

Returer

HashSet<TSource>

En HashSet<T> som innehåller värden av den typ TSource som valts från indatasekvensen.

Undantag

source är null.

Se även

Gäller för