Enumerable.ToHashSet Метод

Определение

Перегрузки

Имя Описание
ToHashSet<TSource>(IEnumerable<TSource>, IEqualityComparer<TSource>)

Создает HashSet<T> из IEnumerable<T> с помощью comparer для сравнения ключей.

ToHashSet<TSource>(IEnumerable<TSource>)

Создает HashSet<T> из IEnumerable<T>.

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

Создает HashSet<T> из IEnumerable<T> с помощью comparer для сравнения ключей.

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)

Параметры типа

TSource

Тип элементов source.

Параметры

source
IEnumerable<TSource>

Объект IEnumerable<T> для создания из HashSet<T> .

comparer
IEqualityComparer<TSource>

Сравнение IEqualityComparer<T> ключей.

Возвращаемое значение

HashSet<TSource>

Значение HashSet<T> , содержащее значения типа TSource , выбранного из входной последовательности.

Исключения

source равно null.

См. также раздел

Применяется к

ToHashSet<TSource>(IEnumerable<TSource>)

Создает HashSet<T> из 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.

Параметры

source
IEnumerable<TSource>

Объект IEnumerable<T> для создания из HashSet<T> .

Возвращаемое значение

HashSet<TSource>

Значение HashSet<T> , содержащее значения типа TSource , выбранного из входной последовательности.

Исключения

source равно null.

См. также раздел

Применяется к