Enumerable.ToHashSet Метод
Определение
Перегрузки
ToHashSet<TSource>(IEnumerable<TSource>, IEqualityComparer<TSource>) |
Создает HashSet<T> из IEnumerable<T> с использованием |
ToHashSet<TSource>(IEnumerable<TSource>) |
Создает HashSet<T> из IEnumerable<T>.Creates a HashSet<T> from an IEnumerable<T>. |
ToHashSet<TSource>(IEnumerable<TSource>, IEqualityComparer<TSource>)
Создает HashSet<T> из IEnumerable<T> с использованием comparer
для сравнения ключей.Creates a HashSet<T> from an IEnumerable<T> using the comparer
to compare keys.
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)
Параметры типа
- TSource
Тип элементов source
.The type of the elements of source
.
Параметры
- source
- IEnumerable<TSource>
IEnumerable<T>, на основе которого создается HashSet<T>.An IEnumerable<T> to create a HashSet<T> from.
- comparer
- IEqualityComparer<TSource>
Компаратор IEqualityComparer<T>, используемый для сравнения ключей.An IEqualityComparer<T> to compare keys.
Возвращаемое значение
- HashSet<TSource>
HashSet<T>, который содержит значения типа TSource
, выбранные из входной последовательности.A HashSet<T> that contains values of type TSource
selected from the input sequence.
Применяется к
ToHashSet<TSource>(IEnumerable<TSource>)
Создает HashSet<T> из IEnumerable<T>.Creates a HashSet<T> from an 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)
Параметры типа
- TSource
Тип элементов source
.The type of the elements of source
.
Параметры
- source
- IEnumerable<TSource>
IEnumerable<T>, на основе которого создается HashSet<T>.An IEnumerable<T> to create a HashSet<T> from.
Возвращаемое значение
- HashSet<TSource>
HashSet<T>, который содержит значения типа TSource
, выбранные из входной последовательности.A HashSet<T> that contains values of type TSource
selected from the input sequence.