CustomStrokes.GetEnumerator Method
Returns an object that implements the System.Collections.IEnumerator interface and that can iterate through the Strokes collections within the CustomStrokes collection.
Namespace: Microsoft.Ink
Assembly: Microsoft.Ink (in Microsoft.Ink.dll)
Syntax
'Declaration
Public Function GetEnumerator As CustomStrokes.CustomStrokesEnumerator
'Usage
Dim instance As CustomStrokes
Dim returnValue As CustomStrokes.CustomStrokesEnumerator
returnValue = instance.GetEnumerator()
public CustomStrokes.CustomStrokesEnumerator GetEnumerator()
public:
CustomStrokes.CustomStrokesEnumerator^ GetEnumerator()
public function GetEnumerator() : CustomStrokes.CustomStrokesEnumerator
Return Value
Type: Microsoft.Ink.CustomStrokes.CustomStrokesEnumerator
Returns an object that implements the System.Collections.IEnumerator interface and that can iterate through the Strokes collections within the CustomStrokes collection.
Examples
These examples show two ways to enumerate the CustomStrokes collection in order to retrieve each Strokes object contained in the collection.
This example obtains the IEnumerator for the CustomStrokes collection, and uses it to traverse the collection. Each Strokes object is then scaled by a factor of 2.
Private Sub EnumerateCustomStrokesWithEnumerator(ByVal mInk As Ink)
Dim mCustomStrokesEnumerator As IEnumerator = mInk.CustomStrokes.GetEnumerator()
mCustomStrokesEnumerator.Reset()
While (mCustomStrokesEnumerator.MoveNext())
Dim S As Strokes = DirectCast(mCustomStrokesEnumerator.Current, Strokes)
S.Scale(2, 2)
End While
End Sub
private void EnumerateCustomStrokesWithEnumerator(Ink mInk)
{
IEnumerator mCustomStrokesEnumerator = mInk.CustomStrokes.GetEnumerator();
mCustomStrokesEnumerator.Reset();
while (mCustomStrokesEnumerator.MoveNext())
{
Strokes S = (Strokes)mCustomStrokesEnumerator.Current;
S.Scale(2, 2);
}
}
This example uses the foreach statement, which calls the GetEnumerator method in internal code that the compiler generates to support the statement.
Private Sub EnumerateCustomStrokesWithForEach(ByVal mInk As Ink)
For Each S As Strokes In mInk.CustomStrokes
S.Scale(2, 2)
Next
End Sub
private void EnumerateCustomStrokesWithForEach(Ink mInk)
{
foreach (Strokes S in mInk.CustomStrokes)
{
S.Scale(2, 2);
}
}
Platforms
Windows 7, Windows Vista, Windows Server 2008 R2, Windows Server 2008
The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.
Version Information
.NET Framework
Supported in: 3.0