Enumerable.ToHashSet Methode

Definition

Überlädt

ToHashSet<TSource>(IEnumerable<TSource>)

Erstellt ein HashSet<T> aus einem IEnumerable<T>.

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

Erstellt ein HashSet<T>-Element aus einem IEnumerable<T>-Element mithilfe des comparer zum Vergleichen von Schlüsseln.

ToHashSet<TSource>(IEnumerable<TSource>)

Erstellt ein HashSet<T> aus einem 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)

Typparameter

TSource

Der Typ der Elemente von source.

Parameter

source
IEnumerable<TSource>

Ein IEnumerable<T>, aus dem ein HashSet<T> erstellt werden soll

Gibt zurück

HashSet<TSource>

Ein HashSet<T>, das Werte vom Typ TSource enthält, die aus der Eingabesequenz ausgewählt werden.

Ausnahmen

source ist null.

Weitere Informationen

Gilt für:

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

Erstellt ein HashSet<T>-Element aus einem IEnumerable<T>-Element mithilfe des comparer zum Vergleichen von Schlüsseln.

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);
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)

Typparameter

TSource

Der Typ der Elemente von source.

Parameter

source
IEnumerable<TSource>

Ein IEnumerable<T>, aus dem ein HashSet<T> erstellt werden soll

comparer
IEqualityComparer<TSource>

Ein IEqualityComparer<T> zum Vergleichen von Schlüsseln.

Gibt zurück

HashSet<TSource>

Ein HashSet<T>, das Werte vom Typ TSource enthält, die aus der Eingabesequenz ausgewählt werden.

Ausnahmen

source ist null.

Weitere Informationen

Gilt für: