Share via


ExtendedProperties.GetEnumerator Method

ExtendedProperties.GetEnumerator Method

Returns an object that implements the System.Collections.IEnumerator Leave Site interface that can iterate through the ExtendedProperty objects within the ExtendedProperties collection.

Definition

Visual Basic .NET Public Function GetEnumerator() As ExtendedPropertiesEnumerator
C# public ExtendedPropertiesEnumerator GetEnumerator();
Managed C++ public: ExtendedPropertiesEnumerator* GetEnumerator();

Return Value

Microsoft.Ink.ExtendedProperties.ExtendedPropertiesEnumerator. Returns an object that implements the IEnumerator Leave Site interface that can iterate through the ExtendedProperty objects within the ExtendedProperties collection.

Examples

[C#]

These C# examples show two ways to iterate over the ExtendedProperties collection and get the name for each ExtendedProperty object in the Stroke object, theStroke. The ExtendedProperties collection is returned by the Stroke.ExtendedProperties property.

This C# example gets the IEnumerator Leave Site for the ExtendedProperties collection.

// Version using GetEnumerator()
ArrayList properties = new ArrayList();
IEnumerator ienum = theStroke.ExtendedProperties.GetEnumerator();
while (ienum.MoveNext())
{
    ExtendedProperty property = (ExtendedProperty) ienum.Current;
    properties.Add(property);
}

This C# example uses the foreach statement, which calls the GetEnumerator method in internal code that the compiler generates to support the statement.

ArrayList properties = new ArrayList();
// Version using foreach
foreach (ExtendedProperty property in theStroke.ExtendedProperties)
{
    properties.Add(property);
}

[VB.NET]

These Microsoft® Visual Basic® .NET examples show two ways to iterate over the ExtendedProperties collection and get the name for each ExtendedProperty object in the Stroke object, theStroke. The ExtendedProperties collection is returned by the Stroke.ExtendedProperties property.

This Visual Basic .NET example gets the IEnumerator Leave Site for the ExtendedProperties collection.

'Version using GetEnumerator()
Dim properties As New ArrayList()
Dim theExtendedProperty As ExtendedProperty
Dim ienum As IEnumerator = theStroke.ExtendedProperties.GetEnumerator()
While (ienum.MoveNext())
    theExtendedProperty = ienum.Current
    properties.Add(theExtendedProperty)
End While

This Visual Basic .NET example uses the For Each statement, which calls the GetEnumerator method in internal code that the compiler generates to support the statement.

'Version using For Each
Dim properties As New ArrayList()
Dim theExtendedProperty As ExtendedProperty
For Each theExtendedProperty In theStroke.ExtendedProperties
    properties.Add(theExtendedProperty)
Next

See Also