Enumerable.ToHashSet Metoda
Ważne
Niektóre informacje odnoszą się do produktu w wersji wstępnej, który może zostać znacząco zmodyfikowany przed wydaniem. Firma Microsoft nie udziela żadnych gwarancji, jawnych lub domniemanych, w odniesieniu do informacji podanych w tym miejscu.
ToHashSet<TSource>(IEnumerable<TSource>) |
Tworzy obiekt na HashSet<T> podstawie elementu IEnumerable<T>. |
ToHashSet<TSource>(IEnumerable<TSource>, IEqualityComparer<TSource>) |
Tworzy obiekt HashSet<T>IEnumerable<T> na podstawie elementu |
- Źródło:
- ToCollection.cs
- Źródło:
- ToCollection.cs
- Źródło:
- ToCollection.cs
Tworzy obiekt na HashSet<T> podstawie elementu 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)
Parametry typu
- TSource
Typ elementów elementu source
.
Parametry
- source
- IEnumerable<TSource>
Element IEnumerable<T> do utworzenia elementu HashSet<T> na podstawie.
Zwraca
Element HashSet<T> zawierający wartości typu TSource
wybrane z sekwencji danych wejściowych.
Wyjątki
source
to null
.
Zobacz też
Dotyczy
.NET 9 i inne wersje
Produkt | Wersje |
---|---|
.NET | Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9 |
.NET Framework | 4.7.2, 4.8, 4.8.1 |
.NET Standard | 2.1 |
- Źródło:
- ToCollection.cs
- Źródło:
- ToCollection.cs
- Źródło:
- ToCollection.cs
Tworzy obiekt HashSet<T>IEnumerable<T> na podstawie elementu comparer
, aby porównać klucze.
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)
Parametry typu
- TSource
Typ elementów elementu source
.
Parametry
- source
- IEnumerable<TSource>
Element IEnumerable<T> do utworzenia elementu HashSet<T> na podstawie.
- comparer
- IEqualityComparer<TSource>
Element IEqualityComparer<T> do porównywania kluczy.
Zwraca
Element HashSet<T> zawierający wartości typu TSource
wybrane z sekwencji danych wejściowych.
Wyjątki
source
to null
.
Zobacz też
Dotyczy
.NET 9 i inne wersje
Produkt | Wersje |
---|---|
.NET | Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9 |
.NET Framework | 4.7.2, 4.8, 4.8.1 |
.NET Standard | 2.1 |
Opinia o produkcie .NET
.NET to projekt typu open source. Wybierz link, aby przekazać opinię: