Enumerable.ToHashSet Metodo
Importante
Alcune informazioni sono relative alla release non definitiva del prodotto, che potrebbe subire modifiche significative prima della release definitiva. Microsoft non riconosce alcuna garanzia, espressa o implicita, in merito alle informazioni qui fornite.
ToHashSet<TSource>(IEnumerable<TSource>) |
Crea un oggetto HashSet<T> da un oggetto IEnumerable<T>. |
ToHashSet<TSource>(IEnumerable<TSource>, IEqualityComparer<TSource>) |
Crea un oggetto HashSet<T> da un oggetto IEnumerable<T> usando |
- Origine:
- ToCollection.cs
- Origine:
- ToCollection.cs
- Origine:
- ToCollection.cs
Crea un oggetto HashSet<T> da un oggetto 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)
Parametri di tipo
- TSource
Tipo degli elementi di source
.
Parametri
- source
- IEnumerable<TSource>
Oggetto IEnumerable<T> da cui creare un oggetto HashSet<T>.
Restituisce
Oggetto HashSet<T> che contiene valori di tipo TSource
selezionati dalla sequenza di input.
Eccezioni
source
è null
.
Vedi anche
Si applica a
.NET 9 e altre versioni
Prodotto | Versioni |
---|---|
.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 |
- Origine:
- ToCollection.cs
- Origine:
- ToCollection.cs
- Origine:
- ToCollection.cs
Crea un oggetto HashSet<T> da un oggetto IEnumerable<T> usando comparer
per confrontare le chiavi.
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)
Parametri di tipo
- TSource
Tipo degli elementi di source
.
Parametri
- source
- IEnumerable<TSource>
Oggetto IEnumerable<T> da cui creare un oggetto HashSet<T>.
- comparer
- IEqualityComparer<TSource>
Oggetto IEqualityComparer<T> per confrontare le chiavi.
Restituisce
Oggetto HashSet<T> che contiene valori di tipo TSource
selezionati dalla sequenza di input.
Eccezioni
source
è null
.
Vedi anche
Si applica a
.NET 9 e altre versioni
Prodotto | Versioni |
---|---|
.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 |
Feedback su .NET
.NET è un progetto di open source. Selezionare un collegamento per fornire feedback: