次の方法で共有


HashSet<T> コンストラクター

定義

HashSet<T> クラスの新しいインスタンスを初期化します。

オーバーロード

名前 説明
HashSet<T>()

空の HashSet<T> クラスの新しいインスタンスを初期化し、セット型の既定の等値比較子を使用します。

HashSet<T>(IEnumerable<T>)

セット型の既定の等値比較子を使用し、指定したコレクションからコピーされた要素を含み、コピーされた要素の数に対応できる十分な容量を持つ、 HashSet<T> クラスの新しいインスタンスを初期化します。

HashSet<T>(IEqualityComparer<T>)

空の HashSet<T> クラスの新しいインスタンスを初期化し、セット型に対して指定された等値比較子を使用します。

HashSet<T>(Int32)

空の HashSet<T> クラスの新しいインスタンスを初期化しますが、 capacity 項目の予約領域があり、セット型の既定の等値比較子を使用します。

HashSet<T>(IEnumerable<T>, IEqualityComparer<T>)

セット型に対して指定した等値比較子を使用し、指定したコレクションからコピーされた要素を含み、コピーされた要素の数に対応できる十分な容量を持つ、 HashSet<T> クラスの新しいインスタンスを初期化します。

HashSet<T>(Int32, IEqualityComparer<T>)

セット型に対して指定された等値比較子を使用し、capacity要素に対応するのに十分な容量を持つ、HashSet<T> クラスの新しいインスタンスを初期化します。

HashSet<T>(SerializationInfo, StreamingContext)
古い.

シリアル化されたデータを使用して、 HashSet<T> クラスの新しいインスタンスを初期化します。

HashSet<T>()

ソース:
HashSet.cs
ソース:
HashSet.cs
ソース:
HashSet.cs
ソース:
HashSet.cs
ソース:
HashSet.cs

空の HashSet<T> クラスの新しいインスタンスを初期化し、セット型の既定の等値比較子を使用します。

public:
 HashSet();
public HashSet();
Public Sub New ()

次の例では、2 つの HashSet<T> オブジェクトを作成して設定する方法を示します。 この例は、 UnionWith メソッドで提供されるより大きな例の一部です。

HashSet<int> evenNumbers = new HashSet<int>();
HashSet<int> oddNumbers = new HashSet<int>();

for (int i = 0; i < 5; i++)
{
    // Populate numbers with just even numbers.
    evenNumbers.Add(i * 2);

    // Populate oddNumbers with just odd numbers.
    oddNumbers.Add((i * 2) + 1);
}
let evenNumbers = HashSet<int>()
let oddNumbers = HashSet<int>()

for i = 0 to 4 do
    // Populate numbers with just even numbers.
    evenNumbers.Add(i * 2) |> ignore

    // Populate oddNumbers with just odd numbers.
    oddNumbers.Add(i * 2 + 1) |> ignore
Dim evenNumbers As HashSet(Of Integer) = New HashSet(Of Integer)()
Dim oddNumbers As HashSet(Of Integer) = New HashSet(Of Integer)()

For i As Integer = 0 To 4

    ' Populate evenNumbers with only even numbers.
    evenNumbers.Add(i * 2)

    ' Populate oddNumbers with only odd numbers.
    oddNumbers.Add((i * 2) + 1)
Next i

注釈

HashSet<T> オブジェクトの容量は、オブジェクトが保持できる要素の数です。 HashSet<T> オブジェクトの容量は、要素がオブジェクトに追加されると自動的に増加します。

このコンストラクターは O(1) 操作です。

適用対象

HashSet<T>(IEnumerable<T>)

ソース:
HashSet.cs
ソース:
HashSet.cs
ソース:
HashSet.cs
ソース:
HashSet.cs
ソース:
HashSet.cs

セット型の既定の等値比較子を使用し、指定したコレクションからコピーされた要素を含み、コピーされた要素の数に対応できる十分な容量を持つ、 HashSet<T> クラスの新しいインスタンスを初期化します。

public:
 HashSet(System::Collections::Generic::IEnumerable<T> ^ collection);
public HashSet(System.Collections.Generic.IEnumerable<T> collection);
new System.Collections.Generic.HashSet<'T> : seq<'T> -> System.Collections.Generic.HashSet<'T>
Public Sub New (collection As IEnumerable(Of T))

パラメーター

collection
IEnumerable<T>

新しいセットに要素がコピーされるコレクション。

例外

collectionnullです。

次の例は、既存のセットから HashSet<T> コレクションを作成する方法を示しています。 この例では、偶数整数と奇数整数をそれぞれ持つ 2 つのセットが作成されます。 その後、偶数の整数セットから 3 番目の HashSet<T> オブジェクトが作成されます。

HashSet<int> evenNumbers = new HashSet<int>();
HashSet<int> oddNumbers = new HashSet<int>();

for (int i = 0; i < 5; i++)
{
    // Populate numbers with just even numbers.
    evenNumbers.Add(i * 2);

    // Populate oddNumbers with just odd numbers.
    oddNumbers.Add((i * 2) + 1);
}

Console.Write("evenNumbers contains {0} elements: ", evenNumbers.Count);
DisplaySet(evenNumbers);

Console.Write("oddNumbers contains {0} elements: ", oddNumbers.Count);
DisplaySet(oddNumbers);

// Create a new HashSet populated with even numbers.
HashSet<int> numbers = new HashSet<int>(evenNumbers);
Console.WriteLine("numbers UnionWith oddNumbers...");
numbers.UnionWith(oddNumbers);

Console.Write("numbers contains {0} elements: ", numbers.Count);
DisplaySet(numbers);

void DisplaySet(HashSet<int> collection)
{
    Console.Write("{");
    foreach (int i in collection)
    {
        Console.Write(" {0}", i);
    }
    Console.WriteLine(" }");
}

/* This example produces output similar to the following:
* evenNumbers contains 5 elements: { 0 2 4 6 8 }
* oddNumbers contains 5 elements: { 1 3 5 7 9 }
* numbers UnionWith oddNumbers...
* numbers contains 10 elements: { 0 2 4 6 8 1 3 5 7 9 }
*/

let displaySet (collection: HashSet<int>) =
    printf "{"

    for i in collection do
        printf $" {i}"

    printfn " }"

let evenNumbers = HashSet<int>()
let oddNumbers = HashSet<int>()

for i = 0 to 4 do
    // Populate numbers with just even numbers.
    evenNumbers.Add(i * 2) |> ignore

    // Populate oddNumbers with just odd numbers.
    oddNumbers.Add(i * 2 + 1) |> ignore

printf $"evenNumbers contains {evenNumbers.Count} elements: "
displaySet evenNumbers

printf $"oddNumbers contains {oddNumbers.Count} elements: "
displaySet oddNumbers

// Create a new HashSet populated with even numbers.
let numbers = HashSet<int> evenNumbers
printfn "numbers UnionWith oddNumbers..."
numbers.UnionWith oddNumbers

printf $"numbers contains {numbers.Count} elements: "
displaySet numbers
// This example produces output similar to the following:
//    evenNumbers contains 5 elements: { 0 2 4 6 8 }
//    oddNumbers contains 5 elements: { 1 3 5 7 9 }
//    numbers UnionWith oddNumbers...
//    numbers contains 10 elements: { 0 2 4 6 8 1 3 5 7 9 }
Shared Sub Main()

    Dim evenNumbers As HashSet(Of Integer) = New HashSet(Of Integer)()
    Dim oddNumbers As HashSet(Of Integer) = New HashSet(Of Integer)()

    For i As Integer = 0 To 4

        ' Populate evenNumbers with only even numbers.
        evenNumbers.Add(i * 2)

        ' Populate oddNumbers with only odd numbers.
        oddNumbers.Add((i * 2) + 1)
    Next i

    Console.Write("evenNumbers contains {0} elements: ", evenNumbers.Count)
    DisplaySet(evenNumbers)

    Console.Write("oddNumbers contains {0} elements: ", oddNumbers.Count)
    DisplaySet(oddNumbers)

    ' Create a new HashSet populated with even numbers.
    Dim numbers As HashSet(Of Integer) = New HashSet(Of Integer)(evenNumbers)
    Console.WriteLine("numbers UnionWith oddNumbers...")
    numbers.UnionWith(oddNumbers)

    Console.Write("numbers contains {0} elements: ", numbers.Count)
    DisplaySet(numbers)
End Sub

注釈

HashSet<T> オブジェクトの容量は、オブジェクトが保持できる要素の数です。 HashSet<T> オブジェクトの容量は、要素がオブジェクトに追加されると自動的に増加します。

collectionに重複が含まれている場合、セットには各一意の要素のいずれかが含まれます。 例外はスローされません。 したがって、結果のセットのサイズは、 collectionのサイズと同じではありません。

このコンストラクターは O(n) 操作です。ここで、 ncollection パラメーター内の要素の数です。

適用対象

HashSet<T>(IEqualityComparer<T>)

ソース:
HashSet.cs
ソース:
HashSet.cs
ソース:
HashSet.cs
ソース:
HashSet.cs
ソース:
HashSet.cs

空の HashSet<T> クラスの新しいインスタンスを初期化し、セット型に対して指定された等値比較子を使用します。

public:
 HashSet(System::Collections::Generic::IEqualityComparer<T> ^ comparer);
public HashSet(System.Collections.Generic.IEqualityComparer<T> comparer);
public HashSet(System.Collections.Generic.IEqualityComparer<T>? comparer);
new System.Collections.Generic.HashSet<'T> : System.Collections.Generic.IEqualityComparer<'T> -> System.Collections.Generic.HashSet<'T>
Public Sub New (comparer As IEqualityComparer(Of T))

パラメーター

comparer
IEqualityComparer<T>

セット内の値を比較するときに使用するIEqualityComparer<T>実装、またはセット型の既定のEqualityComparer<T>実装を使用するnull

注釈

HashSet<T> オブジェクトの容量は、オブジェクトが保持できる要素の数です。 HashSet<T> オブジェクトの容量は、要素がオブジェクトに追加されると自動的に増加します。

このコンストラクターは O(1) 操作です。

適用対象

HashSet<T>(Int32)

ソース:
HashSet.cs
ソース:
HashSet.cs
ソース:
HashSet.cs
ソース:
HashSet.cs
ソース:
HashSet.cs

空の HashSet<T> クラスの新しいインスタンスを初期化しますが、 capacity 項目の予約領域があり、セット型の既定の等値比較子を使用します。

public:
 HashSet(int capacity);
public HashSet(int capacity);
new System.Collections.Generic.HashSet<'T> : int -> System.Collections.Generic.HashSet<'T>
Public Sub New (capacity As Integer)

パラメーター

capacity
Int32

HashSet<T>の初期サイズ。

注釈

サイズ変更は比較的コストがかかるため (再ハッシュが必要)、これは、 capacityの値に基づいて初期容量を設定することで、サイズ変更の必要性を最小限に抑えようとします。

注意事項

capacityユーザー入力から取得した場合は、capacity パラメーターを指定せずにコンストラクター オーバーロードを使用し、要素が追加されるとコレクションのサイズを変更します。 ユーザー指定の値を使用する必要がある場合は、適切な制限 (たとえば、 Math.Clamp(untrustedValue, 0, 20)) にクランプするか、要素数が指定した値と一致することを確認します。

適用対象

HashSet<T>(IEnumerable<T>, IEqualityComparer<T>)

ソース:
HashSet.cs
ソース:
HashSet.cs
ソース:
HashSet.cs
ソース:
HashSet.cs
ソース:
HashSet.cs

セット型に対して指定した等値比較子を使用し、指定したコレクションからコピーされた要素を含み、コピーされた要素の数に対応できる十分な容量を持つ、 HashSet<T> クラスの新しいインスタンスを初期化します。

public:
 HashSet(System::Collections::Generic::IEnumerable<T> ^ collection, System::Collections::Generic::IEqualityComparer<T> ^ comparer);
public HashSet(System.Collections.Generic.IEnumerable<T> collection, System.Collections.Generic.IEqualityComparer<T> comparer);
public HashSet(System.Collections.Generic.IEnumerable<T> collection, System.Collections.Generic.IEqualityComparer<T>? comparer);
new System.Collections.Generic.HashSet<'T> : seq<'T> * System.Collections.Generic.IEqualityComparer<'T> -> System.Collections.Generic.HashSet<'T>
Public Sub New (collection As IEnumerable(Of T), comparer As IEqualityComparer(Of T))

パラメーター

collection
IEnumerable<T>

新しいセットに要素がコピーされるコレクション。

comparer
IEqualityComparer<T>

セット内の値を比較するときに使用するIEqualityComparer<T>実装、またはセット型の既定のEqualityComparer<T>実装を使用するnull

例外

collectionnullです。

次の例では、指定された IEqualityComparer<T> を使用して、車両の種類の HashSet<T> コレクションの要素で大文字と小文字を区別しない比較を行います。

HashSet<string> allVehicles = new HashSet<string>(StringComparer.OrdinalIgnoreCase);
List<string> someVehicles = new List<string>();

someVehicles.Add("Planes");
someVehicles.Add("Trains");
someVehicles.Add("Automobiles");

// Add in the vehicles contained in the someVehicles list.
allVehicles.UnionWith(someVehicles);

Console.WriteLine("The current HashSet contains:\n");
foreach (string vehicle in allVehicles)
{
    Console.WriteLine(vehicle);
}

allVehicles.Add("Ships");
allVehicles.Add("Motorcycles");
allVehicles.Add("Rockets");
allVehicles.Add("Helicopters");
allVehicles.Add("Submarines");

Console.WriteLine("\nThe updated HashSet contains:\n");
foreach (string vehicle in allVehicles)
{
    Console.WriteLine(vehicle);
}

// Verify that the 'All Vehicles' set contains at least the vehicles in
// the 'Some Vehicles' list.
if (allVehicles.IsSupersetOf(someVehicles))
{
    Console.Write("\nThe 'All' vehicles set contains everything in ");
    Console.WriteLine("'Some' vechicles list.");
}

// Check for Rockets. Here the OrdinalIgnoreCase comparer will compare
// true for the mixed-case vehicle type.
if (allVehicles.Contains("roCKeTs"))
{
    Console.WriteLine("\nThe 'All' vehicles set contains 'roCKeTs'");
}

allVehicles.ExceptWith(someVehicles);
Console.WriteLine("\nThe excepted HashSet contains:\n");
foreach (string vehicle in allVehicles)
{
    Console.WriteLine(vehicle);
}

// Remove all the vehicles that are not 'super cool'.
allVehicles.RemoveWhere(isNotSuperCool);

Console.WriteLine("\nThe super cool vehicles are:\n");
foreach (string vehicle in allVehicles)
{
    Console.WriteLine(vehicle);
}

// Predicate to determine vehicle 'coolness'.
bool isNotSuperCool(string vehicle)
{
    bool superCool = (vehicle == "Helicopters") || (vehicle == "Motorcycles");

    return !superCool;
}

// The program writes the following output to the console.
//
// The current HashSet contains:
//
// Planes
// Trains
// Automobiles
//
// The updated HashSet contains:
//
// Planes
// Trains
// Automobiles
// Ships
// Motorcycles
// Rockets
// Helicopters
// Submarines
//
// The 'All' vehicles set contains everything in 'Some' vechicles list.
//
// The 'All' vehicles set contains 'roCKeTs'
//
// The excepted HashSet contains:
//
// Ships
// Motorcycles
// Rockets
// Helicopters
// Submarines
//
// The super cool vehicles are:
//
// Motorcycles
// Helicopters
let allVehicles = HashSet<string> StringComparer.OrdinalIgnoreCase
let someVehicles = ResizeArray()

someVehicles.Add "Planes"
someVehicles.Add "Trains"
someVehicles.Add "Automobiles"

// Add in the vehicles contained in the someVehicles list.
allVehicles.UnionWith someVehicles

printfn "The current HashSet contains:\n"

for vehicle in allVehicles do
    printfn $"{vehicle}"

allVehicles.Add "Ships" |> ignore
allVehicles.Add "Motorcycles" |> ignore
allVehicles.Add "Rockets" |> ignore
allVehicles.Add "Helicopters" |> ignore
allVehicles.Add "Submarines" |> ignore

printfn "\nThe updated HashSet contains:\n"

for vehicle in allVehicles do
    printfn $"{vehicle}"

// Verify that the 'All Vehicles' set contains at least the vehicles in
// the 'Some Vehicles' list.
if allVehicles.IsSupersetOf someVehicles then
    printfn "\nThe 'All' vehicles set contains everything in 'Some' vehicles list."

// Check for Rockets. Here the OrdinalIgnoreCase comparer will compare
// true for the mixed-case vehicle type.
if allVehicles.Contains "roCKeTs" then
    printfn "\nThe 'All' vehicles set contains 'roCKeTs'"

allVehicles.ExceptWith someVehicles
printfn "\nThe excepted HashSet contains:\n"

for vehicle in allVehicles do
    printfn $"{vehicle}"

// Predicate to determine vehicle 'coolness'.
let isNotSuperCool vehicle =
    let superCool = vehicle = "Helicopters" || vehicle = "Motorcycles"
    not superCool

// Remove all the vehicles that are not 'super cool'.
allVehicles.RemoveWhere isNotSuperCool |> ignore

printfn "\nThe super cool vehicles are:\n"

for vehicle in allVehicles do
    printfn $"{vehicle}"

// The program writes the following output to the console.
//
// The current HashSet contains:
//
// Planes
// Trains
// Automobiles
//
// The updated HashSet contains:
//
// Planes
// Trains
// Automobiles
// Ships
// Motorcycles
// Rockets
// Helicopters
// Submarines
//
// The 'All' vehicles set contains everything in 'Some' vehicles list.
//
// The 'All' vehicles set contains 'roCKeTs'
//
// The excepted HashSet contains:
//
// Ships
// Motorcycles
// Rockets
// Helicopters
// Submarines
//
// The super cool vehicles are:
//
// Motorcycles
// Helicopters
Imports System.Collections.Generic

Class Program
    Public Shared Sub Main()
        Dim allVehicles As New HashSet(Of String)(StringComparer.OrdinalIgnoreCase)
        Dim someVehicles As New List(Of String)()

        someVehicles.Add("Planes")
        someVehicles.Add("Trains")
        someVehicles.Add("Automobiles")

        ' Add in the vehicles contained in the someVehicles list.
        allVehicles.UnionWith(someVehicles)

        Console.WriteLine("The current HashSet contains:" + Environment.NewLine)
        For Each vehicle As String In allVehicles
            Console.WriteLine(vehicle)
        Next vehicle

        allVehicles.Add("Ships")
        allVehicles.Add("Motorcycles")
        allVehicles.Add("Rockets")
        allVehicles.Add("Helicopters")
        allVehicles.Add("Submarines")

        Console.WriteLine(Environment.NewLine + "The updated HashSet contains:" + Environment.NewLine)
        For Each vehicle As String In allVehicles
            Console.WriteLine(vehicle)
        Next vehicle

        ' Verify that the 'All Vehicles' set contains at least the vehicles in
        ' the 'Some Vehicles' list.
        If allVehicles.IsSupersetOf(someVehicles) Then
            Console.Write(Environment.NewLine + "The 'All' vehicles set contains everything in ")
            Console.WriteLine("'Some' vechicles list.")
        End If

        ' Check for Rockets. Here the OrdinalIgnoreCase comparer will compare
        ' True for the mixed-case vehicle type.
        If allVehicles.Contains("roCKeTs") Then
            Console.WriteLine(Environment.NewLine + "The 'All' vehicles set contains 'roCKeTs'")
        End If

        allVehicles.ExceptWith(someVehicles)
        Console.WriteLine(Environment.NewLine + "The excepted HashSet contains:" + Environment.NewLine)
        For Each vehicle As String In allVehicles
            Console.WriteLine(vehicle)
        Next vehicle

        ' Remove all the vehicles that are not 'super cool'.
        allVehicles.RemoveWhere(AddressOf isNotSuperCool)

        Console.WriteLine(Environment.NewLine + "The super cool vehicles are:" + Environment.NewLine)
        For Each vehicle As String In allVehicles
            Console.WriteLine(vehicle)
        Next vehicle
    End Sub

    ' Predicate to determine vehicle 'coolness'.
    Private Shared Function isNotSuperCool(vehicle As String) As Boolean
        Dim notSuperCool As Boolean = _
            (vehicle <> "Helicopters") And (vehicle <> "Motorcycles")

        Return notSuperCool
    End Function
End Class

'
' The program writes the following output to the console.
'
' The current HashSet contains:
'
' Planes
' Trains
' Automobiles
'
' The updated HashSet contains:
'
' Planes
' Trains
' Automobiles
' Ships
' Motorcycles
' Rockets
' Helicopters
' Submarines
'
' The 'All' vehicles set contains everything in 'Some' vechicles list.
'
' The 'All' vehicles set contains 'roCKeTs'
'
' The excepted HashSet contains:
'
' Ships
' Motorcycles
' Rockets
' Helicopters
' Submarines
'
' The super cool vehicles are:
'
' Motorcycles
' Helicopters

注釈

HashSet<T> オブジェクトの容量は、オブジェクトが保持できる要素の数です。 HashSet<T> オブジェクトの容量は、要素がオブジェクトに追加されると自動的に増加します。

collectionに重複が含まれている場合、セットには各一意の要素のいずれかが含まれます。 例外はスローされません。 したがって、結果のセットのサイズは、 collectionのサイズと同じではありません。

このコンストラクターは O(n) 操作です。ここで、 ncollection パラメーター内の要素の数です。

適用対象

HashSet<T>(Int32, IEqualityComparer<T>)

ソース:
HashSet.cs
ソース:
HashSet.cs
ソース:
HashSet.cs
ソース:
HashSet.cs
ソース:
HashSet.cs

セット型に対して指定された等値比較子を使用し、capacity要素に対応するのに十分な容量を持つ、HashSet<T> クラスの新しいインスタンスを初期化します。

public:
 HashSet(int capacity, System::Collections::Generic::IEqualityComparer<T> ^ comparer);
public HashSet(int capacity, System.Collections.Generic.IEqualityComparer<T>? comparer);
public HashSet(int capacity, System.Collections.Generic.IEqualityComparer<T> comparer);
new System.Collections.Generic.HashSet<'T> : int * System.Collections.Generic.IEqualityComparer<'T> -> System.Collections.Generic.HashSet<'T>
Public Sub New (capacity As Integer, comparer As IEqualityComparer(Of T))

パラメーター

capacity
Int32

HashSet<T>の初期サイズ。

comparer
IEqualityComparer<T>

セット内の値を比較するときに使用する IEqualityComparer<T> 実装、またはセット型の既定の IEqualityComparer<T> 実装を使用する場合は null (Visual Basic では Nothing) です。

注釈

サイズ変更は比較的コストがかかるため (再ハッシュが必要)、これは、 capacityの値に基づいて初期容量を設定することで、サイズ変更の必要性を最小限に抑えようとします。

注意事項

capacityユーザー入力から取得した場合は、capacity パラメーターを指定せずにコンストラクター オーバーロードを使用し、要素が追加されるとコレクションのサイズを変更します。 ユーザー指定の値を使用する必要がある場合は、適切な制限 (たとえば、 Math.Clamp(untrustedValue, 0, 20)) にクランプするか、要素数が指定した値と一致することを確認します。

適用対象

HashSet<T>(SerializationInfo, StreamingContext)

ソース:
HashSet.cs
ソース:
HashSet.cs
ソース:
HashSet.cs
ソース:
HashSet.cs
ソース:
HashSet.cs

注意事項

This API supports obsolete formatter-based serialization. It should not be called or extended by application code.

シリアル化されたデータを使用して、 HashSet<T> クラスの新しいインスタンスを初期化します。

protected:
 HashSet(System::Runtime::Serialization::SerializationInfo ^ info, System::Runtime::Serialization::StreamingContext context);
[System.Obsolete("This API supports obsolete formatter-based serialization. It should not be called or extended by application code.", DiagnosticId="SYSLIB0051", UrlFormat="https://aka.ms/dotnet-warnings/{0}")]
protected HashSet(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context);
protected HashSet(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context);
[<System.Obsolete("This API supports obsolete formatter-based serialization. It should not be called or extended by application code.", DiagnosticId="SYSLIB0051", UrlFormat="https://aka.ms/dotnet-warnings/{0}")>]
new System.Collections.Generic.HashSet<'T> : System.Runtime.Serialization.SerializationInfo * System.Runtime.Serialization.StreamingContext -> System.Collections.Generic.HashSet<'T>
new System.Collections.Generic.HashSet<'T> : System.Runtime.Serialization.SerializationInfo * System.Runtime.Serialization.StreamingContext -> System.Collections.Generic.HashSet<'T>
Protected Sub New (info As SerializationInfo, context As StreamingContext)

パラメーター

info
SerializationInfo

HashSet<T> オブジェクトのシリアル化に必要な情報を格納しているSerializationInfo オブジェクト。

context
StreamingContext

HashSet<T> オブジェクトに関連付けられたシリアル化ストリームのソースと宛先を格納するStreamingContext構造体。

属性

注釈

このコンストラクターは、ストリーム経由で送信されるオブジェクトを再構成するために、逆シリアル化中に呼び出されます。 詳細については、「 XML および SOAP シリアル化」を参照してください。

適用対象