다음을 통해 공유


ConfigurationElementCollectionBase<T>.GetEnumerator 메서드

정의

컬렉션을 반복하는 열거자를 반환합니다.

public:
 virtual System::Collections::Generic::IEnumerator<T> ^ GetEnumerator();
public System.Collections.Generic.IEnumerator<T> GetEnumerator ();
abstract member GetEnumerator : unit -> System.Collections.Generic.IEnumerator<'T (requires 'T :> Microsoft.Web.Administration.ConfigurationElement)>
override this.GetEnumerator : unit -> System.Collections.Generic.IEnumerator<'T (requires 'T :> Microsoft.Web.Administration.ConfigurationElement)>
Public Function GetEnumerator () As IEnumerator(Of T)

반환

IEnumerator 컬렉션을 반복하는 인터페이스입니다.

구현

설명

열거자를 직접 조작하는 대신 열거자의 복잡성을 숨기는 C# foreach 문(for each C++, For Each Visual Basic의 경우)을 사용해야 합니다.

컬렉션 전체를 열거하는 프로시저는 기본적으로 스레드로부터 안전하지 않습니다. 컬렉션이 동기화되어 있을 때 다른 스레드에서 해당 컬렉션을 수정할 수 있으므로 이렇게 되면 열거자에서 예외가 throw됩니다. 을 열거 하는 동안 스레드로부터 안전을 보장 하기 위해 전체 열거 동안 컬렉션을 잠글 또는 다른 스레드에서 변경에서 발생 하는 예외를 catch 합니다. 읽기 및 쓰기를 위해 여러 스레드에서 컬렉션에 액세스할 수 있도록 하려면 고유한 동기화를 구현해야 합니다.

적용 대상