Strokes.StrokesEnumerator.Reset 메서드
업데이트: 2007년 11월
열거자 인덱스를 Strokes 컬렉션의 시작 부분으로 다시 설정합니다.
네임스페이스: Microsoft.Ink
어셈블리: Microsoft.Ink(Microsoft.Ink.dll)
구문
‘선언
Public Sub Reset
‘사용 방법
Dim instance As Strokes..::.StrokesEnumerator
instance.Reset()
public void Reset()
public:
virtual void Reset() sealed
public final void Reset()
public final function Reset()
구현
설명
Strokes.StrokesEnumerator 클래스는 Strokes 컬렉션을 반복하며 IEnumerator 인터페이스를 구현합니다.
이 메서드는 Reset 메서드에서 상속됩니다.
예제
이 예제에서는 Strokes 컬렉션을 열거하여 컬렉션에 들어 있는 각 Stroke 개체를 검색하는 두 가지 방법을 보여 줍니다. Ink.Strokes 속성에서 Strokes 컬렉션을 반환합니다.
이 예제에서는 Strokes 컬렉션의 IEnumerator를 가져와서 컬렉션을 순회하는 데 사용합니다.
Private Sub EnumerateStrokesWithEnumerator(ByVal mInk As Ink)
' access the Strokes property via using statement
' to insure that the object mStrokes is disposed when finished
' Otherwise, you will have a memory leak
Using mStrokes As Strokes = mInk.Strokes
Dim mStrokesEnumerator As IEnumerator = mStrokes.GetEnumerator()
mStrokesEnumerator.Reset()
While (mStrokesEnumerator.MoveNext())
Dim S As Stroke = DirectCast(mStrokesEnumerator.Current, Stroke)
Me.listBoxStrokeId.Items.Add(S.Id)
End While
End Using
End Sub
private void EnumerateStrokesWithEnumerator(Ink mInk)
{
// access the Strokes property via using statement
// to insure that the object mStrokes is disposed when finished
// Otherwise, you will have a memory leak
using (Strokes mStrokes = mInk.Strokes)
{
IEnumerator mStrokesEnumerator = mStrokes.GetEnumerator();
mStrokesEnumerator.Reset();
while (mStrokesEnumerator.MoveNext())
{
Stroke S = (Stroke)mStrokesEnumerator.Current;
this.listBoxStrokeId.Items.Add(S.Id);
}
}
}
이 예제에서는 foreach 문을 사용합니다. 이 명령문을 지원하기 위해 컴파일러에서 생성하는 내부 코드는 GetEnumerator 메서드를 호출합니다.
Private Sub EnumerateStrokesWithForEach(ByVal mInk As Ink)
' access the Strokes property via using statement
' to insure that the object mStrokes is disposed when finished
' Otherwise, you will have a memory leak
Using mStrokes As Strokes = mInk.Strokes
For Each S As Stroke In mStrokes
Me.listBoxStrokeId.Items.Add(S.Id)
Next
End Using
End Sub
private void EnumerateStrokesWithForEach(Ink mInk)
{
// access the Strokes property via using statement
// to insure that the object mStrokes is disposed when finished
// Otherwise, you will have a memory leak
using (Strokes mStrokes = mInk.Strokes)
{
foreach (Stroke S in mStrokes)
{
this.listBoxStrokeId.Items.Add(S.Id);
}
}
}
플랫폼
Windows Vista
.NET Framework 및 .NET Compact Framework에서 모든 플랫폼의 전체 버전을 지원하지는 않습니다. 지원되는 버전의 목록을 보려면 .NET Framework 시스템 요구 사항을 참조하십시오.
버전 정보
.NET Framework
3.0에서 지원