SortedSet<T>.Enumerator 구조체

정의

SortedSet<T> 개체의 요소를 열거합니다.

public: value class SortedSet<T>::Enumerator : System::Collections::Generic::IEnumerator<T>
public: value class SortedSet<T>::Enumerator : System::Collections::Generic::IEnumerator<T>, System::Runtime::Serialization::IDeserializationCallback, System::Runtime::Serialization::ISerializable
public struct SortedSet<T>.Enumerator : System.Collections.Generic.IEnumerator<T>
public struct SortedSet<T>.Enumerator : System.Collections.Generic.IEnumerator<T>, System.Runtime.Serialization.IDeserializationCallback, System.Runtime.Serialization.ISerializable
[System.Serializable]
public struct SortedSet<T>.Enumerator : System.Collections.Generic.IEnumerator<T>, System.Runtime.Serialization.IDeserializationCallback, System.Runtime.Serialization.ISerializable
type SortedSet<'T>.Enumerator = struct
    interface IEnumerator<'T>
    interface IEnumerator
    interface IDisposable
type SortedSet<'T>.Enumerator = struct
    interface IEnumerator<'T>
    interface IEnumerator
    interface IDisposable
    interface IDeserializationCallback
    interface ISerializable
[<System.Serializable>]
type SortedSet<'T>.Enumerator = struct
    interface IEnumerator<'T>
    interface IDisposable
    interface IEnumerator
    interface ISerializable
    interface IDeserializationCallback
[<System.Serializable>]
type SortedSet<'T>.Enumerator = struct
    interface IEnumerator<'T>
    interface IEnumerator
    interface ISerializable
    interface IDeserializationCallback
    interface IDisposable
Public Structure SortedSet(Of T).Enumerator
Implements IEnumerator(Of T)
Public Structure SortedSet(Of T).Enumerator
Implements IDeserializationCallback, IEnumerator(Of T), ISerializable

형식 매개 변수

T
상속
SortedSet<T>.Enumerator
특성
구현

설명

C# 언어for each(C++, For Each Visual Basic)의 문은 foreach 열거자의 복잡성을 숨깁니다. 그러므로 열거자를 직접 조작하는 대신 foreach를 사용하는 것이 좋습니다.

열거자를 사용하여 컬렉션의 데이터를 읽을 수는 있지만 내부 컬렉션을 수정할 수는 없습니다.

처음에 열거자는 컬렉션의 첫 번째 요소 앞에 배치됩니다. 이 위치에 Current 속성 정의 되지 않습니다. 따라서 호출 해야 합니다 MoveNext 해당 열거자의 값을 읽기 전에 컬렉션의 첫 번째 요소를 이동 하는 방법 Current합니다.

CurrentMoveNext가 호출될 때까지 동일한 개체를 반환합니다. MoveNextCurrent를 다음 요소로 설정합니다.

경우 MoveNext 열거자를 컬렉션의 끝 컬렉션의 마지막 요소 뒤에 배치 되는 전달 하 고 MoveNext 반환 false합니다. 열거자가 있는 경우이 위치에 대 한 후속 호출은 MoveNext 반환할 수도 false합니다. 반환 falseCurrentMoveNext 마지막 호출이 정의되지 않은 경우 컬렉션의 첫 번째 요소로 다시 설정할 Current 수 없습니다. 대신 새 열거자 개체를 만들어야 합니다.

컬렉션이 변경되지 않고 그대로 유지되는 한 열거자는 유효한 상태로 유지됩니다. 변경에 추가 하는 등 컬렉션을 수정 하거나 요소를 삭제, 열거자가 복구할 유효 하지 않으며을 다음에 호출할 MoveNext 또는 IEnumerator.Reset throw는 InvalidOperationException합니다.

열거자는 컬렉션에 대한 단독 액세스 권한이 없습니다. 따라서 컬렉션을 열거하는 것은 본질적으로 스레드로부터 안전한 프로시저가 아닙니다. 열거 동안 스레드 보안을 보장하려면 전체 열거 동안 컬렉션을 잠그면 됩니다. 여러 스레드에서 컬렉션에 액세스하여 읽고 쓸 수 있도록 허용하려면 사용자 지정 동기화를 구현해야 합니다.

System.Collections.Generic 네임스페이스에서 컬렉션의 기본 구현은 동기화되지 않습니다.

속성

Current

열거자의 현재 위치에 있는 요소를 가져옵니다.

메서드

Dispose()

SortedSet<T>.Enumerator에서 사용하는 모든 리소스를 해제합니다.

MoveNext()

열거자를 SortedSet<T> 컬렉션의 다음 요소로 이동합니다.

명시적 인터페이스 구현

IDeserializationCallback.OnDeserialization(Object)

ISerializable 인터페이스를 구현하고, deserialization이 완료되면 deserialization 이벤트를 발생시킵니다.

IEnumerator.Current

열거자의 현재 위치에 있는 요소를 가져옵니다.

IEnumerator.Reset()

컬렉션의 첫 번째 요소 앞의 초기 위치에 열거자를 설정합니다.

ISerializable.GetObjectData(SerializationInfo, StreamingContext)

ISerializable 인터페이스를 구현하고 SortedSet<T> 인스턴스를 직렬화하는 데 필요한 데이터를 반환합니다.

적용 대상