Enumerable.ToHashSet メソッド

定義

オーバーロード

ToHashSet<TSource>(IEnumerable<TSource>)

IEnumerable<T> から HashSet<T> を作成します。

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

comparer を使用して IEnumerable<T>から HashSet<T> を作成し、キーを比較します。

ToHashSet<TSource>(IEnumerable<TSource>)

IEnumerable<T> から HashSet<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>

HashSet<T> の作成元の IEnumerable<T>

戻り値

HashSet<TSource>

入力シーケンスから選択された TSource 型の値を格納する HashSet<T>

例外

sourcenullです。

こちらもご覧ください

適用対象

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

comparer を使用して IEnumerable<T>から HashSet<T> を作成し、キーを比較します。

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 の要素の型。

パラメーター

source
IEnumerable<TSource>

HashSet<T> の作成元の IEnumerable<T>

comparer
IEqualityComparer<TSource>

キーを比較する IEqualityComparer<T>

戻り値

HashSet<TSource>

入力シーケンスから選択された TSource 型の値を格納する HashSet<T>

例外

sourcenullです。

こちらもご覧ください

適用対象