다음을 통해 공유


Tablets.GetEnumerator 메서드

업데이트: 2007년 11월

System.Collections.IEnumerator 인터페이스를 구현하고 Tablets 컬렉션 내의 Tablet 개체를 반복할 수 있는 개체를 반환합니다.

네임스페이스:  Microsoft.Ink
어셈블리:  Microsoft.Ink(Microsoft.Ink.dll)

구문

‘선언
Public Function GetEnumerator As Tablets..::.TabletsEnumerator
‘사용 방법
Dim instance As Tablets
Dim returnValue As Tablets..::.TabletsEnumerator

returnValue = instance.GetEnumerator()
public Tablets..::.TabletsEnumerator GetEnumerator()
public:
Tablets..::.TabletsEnumerator^ GetEnumerator()
public Tablets..::.TabletsEnumerator GetEnumerator()
public function GetEnumerator() : Tablets..::.TabletsEnumerator

반환 값

형식: Microsoft.Ink.Tablets.TabletsEnumerator
IEnumerator 인터페이스를 구현하고 Tablets 컬렉션 내에서 Tablet 개체를 반복할 수 있는 개체를 반환합니다.

예제

이 예제에서는 Tablets 컬렉션인 allTablets를 반복하면서 ListBox 개체인 listBoxTablets를 시스템에 연결된 각 태블릿 장치의 이름으로 채우는 두 가지 방법을 보여 줍니다.

이 예제에서는 Tablets 컬렉션의 IEnumerator를 가져옵니다.

' Calling the constructor automatically fills the 
' Tablets collection with the available Tablet objects.
Dim allTablets As Tablets = New Tablets()

' clear the list box
Me.listBoxTablets.Items.Clear()

' populate the list box with the name of each tablet
' version using GetEnumerator()
Dim theTabletsEnumerator As IEnumerator = allTablets.GetEnumerator()
While (theTabletsEnumerator.MoveNext())
    Dim T As Tablet = theTabletsEnumerator.Current
    Me.listBoxTablets.Items.Add(T.Name)
End While
// Calling the constructor automatically fills the 
// Tablets collection with the available Tablet objects.
Tablets allTablets = new Tablets();

// clear the list box
this.listBoxTablets.Items.Clear();

// populate the list box with the name of each tablet
// version using GetEnumerator()
IEnumerator theTabletsEnumerator = allTablets.GetEnumerator();
while (theTabletsEnumerator.MoveNext())
{
    Tablet T = (Tablet)theTabletsEnumerator.Current;
    this.listBoxTablets.Items.Add(T.Name);
}

이 예제에서는 foreach 문을 사용합니다. 이 명령문을 지원하기 위해 컴파일러에서 생성하는 내부 코드는 GetEnumerator 메서드를 호출합니다.

' Calling the constructor automatically fills the 
' Tablets collection with the available Tablet objects.
Dim allTablets As Tablets = New Tablets()

' clear the list box
Me.listBoxTablets.Items.Clear()

' populate the list box with the name of each tablet
' version using For Each
For Each T As Tablet In allTablets
    Me.listBoxTablets.Items.Add(T.Name)
Next
// Calling the constructor automatically fills the 
// Tablets collection with the available Tablet objects.
Tablets allTablets = new Tablets();

// clear the list box
this.listBoxTablets.Items.Clear();

// populate the list box with the name of each tablet
// version using foreach
foreach (Tablet T in allTablets)
{
    this.listBoxTablets.Items.Add(T.Name);
}

플랫폼

Windows Vista

.NET Framework 및 .NET Compact Framework에서 모든 플랫폼의 전체 버전을 지원하지는 않습니다. 지원되는 버전의 목록을 보려면 .NET Framework 시스템 요구 사항을 참조하십시오.

버전 정보

.NET Framework

3.0에서 지원

참고 항목

참조

Tablets 클래스

Tablets 멤버

Microsoft.Ink 네임스페이스

Tablet