SortedSet<T> 생성자

정의

SortedSet<T> 클래스의 새 인스턴스를 초기화합니다.

오버로드

SortedSet<T>()

SortedSet<T> 클래스의 새 인스턴스를 초기화합니다.

SortedSet<T>(IComparer<T>)

지정된 비교자를 사용하는 SortedSet<T> 클래스의 새 인스턴스를 초기화합니다.

SortedSet<T>(IEnumerable<T>)

지정한 열거 가능한 컬렉션에서 복사된 요소를 포함하는 SortedSet<T> 클래스의 새 인스턴스를 초기화합니다.

SortedSet<T>(IEnumerable<T>, IComparer<T>)

지정한 열거 가능한 컬렉션에서 복사된 요소를 포함하고 지정된 비교자를 사용하는 SortedSet<T> 클래스의 새 인스턴스를 초기화합니다.

SortedSet<T>(SerializationInfo, StreamingContext)
사용되지 않음.

serialize된 데이터가 들어 있는 SortedSet<T> 클래스의 새 인스턴스를 초기화합니다.

설명

이 생성자는 작업입니다 O(1) .

SortedSet<T>()

Source:
SortedSet.cs
Source:
SortedSet.cs
Source:
SortedSet.cs

SortedSet<T> 클래스의 새 인스턴스를 초기화합니다.

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

적용 대상

SortedSet<T>(IComparer<T>)

Source:
SortedSet.cs
Source:
SortedSet.cs
Source:
SortedSet.cs

지정된 비교자를 사용하는 SortedSet<T> 클래스의 새 인스턴스를 초기화합니다.

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

매개 변수

comparer
IComparer<T>

개체 비교에 사용할 기본 비교자입니다.

예외

comparer이(가) null인 경우

예제

다음 예제에서는 파일 이름을 확장명으로 정렬하는 정렬된 집합을 생성하는 데 사용되는 비교자(ByFileExtension)를 정의합니다. 이 코드 예제는에 대해 제공 된 큰 예제의 일부는 SortedSet<T> 클래스입니다.

// Create a sorted set using the ByFileExtension comparer.
var mediaFiles1 = new SortedSet<string>(new ByFileExtension());
' Create a sorted set using the ByFileExtension comparer.
Dim mediaFiles1 As New SortedSet(Of String)(New ByFileExtension)
// Defines a comparer to create a sorted set
// that is sorted by the file extensions.
public class ByFileExtension : IComparer<string>
{
    string xExt, yExt;

    CaseInsensitiveComparer caseiComp = new CaseInsensitiveComparer();

    public int Compare(string x, string y)
    {
        // Parse the extension from the file name.
        xExt = x.Substring(x.LastIndexOf(".") + 1);
        yExt = y.Substring(y.LastIndexOf(".") + 1);

        // Compare the file extensions.
        int vExt = caseiComp.Compare(xExt, yExt);
        if (vExt != 0)
        {
            return vExt;
        }
        else
        {
            // The extension is the same,
            // so compare the filenames.
            return caseiComp.Compare(x, y);
        }
    }
}
' Defines a comparer to create a sorted set
' that is sorted by the file extensions.
Public Class ByFileExtension
    Implements IComparer(Of String)
    Dim xExt, yExt As String

    Dim caseiComp As CaseInsensitiveComparer = _
                        New CaseInsensitiveComparer
    Public Function Compare(x As String, y As String) _
        As Integer Implements IComparer(Of String).Compare
        ' Parse the extension from the file name.
        xExt = x.Substring(x.LastIndexOf(".") + 1)
        yExt = y.Substring(y.LastIndexOf(".") + 1)

        ' Compare the file extensions.
        Dim vExt As Integer = caseiComp.Compare(xExt, yExt)
        If vExt <> 0 Then
            Return vExt
        Else
            ' The extension is the same, 
            ' so compare the filenames. 
            Return caseiComp.Compare(x, y)
        End If
    End Function        
    
End Class

적용 대상

SortedSet<T>(IEnumerable<T>)

Source:
SortedSet.cs
Source:
SortedSet.cs
Source:
SortedSet.cs

지정한 열거 가능한 컬렉션에서 복사된 요소를 포함하는 SortedSet<T> 클래스의 새 인스턴스를 초기화합니다.

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

매개 변수

collection
IEnumerable<T>

복사할 열거 가능한 컬렉션입니다.

설명

열거 가능한 컬렉션의 중복 요소는 클래스의 SortedSet<T> 새 instance 복사되지 않으며 예외가 throw되지 않습니다.

이 생성자는 연산입니다 O(n log n) . 여기서 n 는 매개 변수의 요소 collection 수입니다.

적용 대상

SortedSet<T>(IEnumerable<T>, IComparer<T>)

Source:
SortedSet.cs
Source:
SortedSet.cs
Source:
SortedSet.cs

지정한 열거 가능한 컬렉션에서 복사된 요소를 포함하고 지정된 비교자를 사용하는 SortedSet<T> 클래스의 새 인스턴스를 초기화합니다.

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

매개 변수

collection
IEnumerable<T>

복사할 열거 가능한 컬렉션입니다.

comparer
IComparer<T>

개체 비교에 사용할 기본 비교자입니다.

예외

collection이(가) null인 경우

적용 대상

SortedSet<T>(SerializationInfo, StreamingContext)

Source:
SortedSet.cs
Source:
SortedSet.cs
Source:
SortedSet.cs

주의

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

serialize된 데이터가 들어 있는 SortedSet<T> 클래스의 새 인스턴스를 초기화합니다.

protected:
 SortedSet(System::Runtime::Serialization::SerializationInfo ^ info, System::Runtime::Serialization::StreamingContext context);
protected SortedSet (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 SortedSet (System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context);
new System.Collections.Generic.SortedSet<'T> : System.Runtime.Serialization.SerializationInfo * System.Runtime.Serialization.StreamingContext -> System.Collections.Generic.SortedSet<'T>
[<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.SortedSet<'T> : System.Runtime.Serialization.SerializationInfo * System.Runtime.Serialization.StreamingContext -> System.Collections.Generic.SortedSet<'T>
Protected Sub New (info As SerializationInfo, context As StreamingContext)

매개 변수

info
SerializationInfo

SortedSet<T> 개체를 serialize하는 데 필요한 정보가 들어 있는 개체입니다.

context
StreamingContext

SortedSet<T> 개체에 연결된 serialize된 스트림의 소스와 대상이 들어 있는 구조체입니다.

특성

설명

이 생성자는 역직렬화 중에 호출되어 스트림을 통해 전송되는 개체를 재구성합니다.

적용 대상