Share via


AnalysisWarningCollection.GetEnumerator Method

Returns an object that implements the IEnumerator interface and that can iterate through the AnalysisWarning objects within the AnalysisWarningCollection.

Namespace:  System.Windows.Ink
Assembly:  IAWinFX (in IAWinFX.dll)

Syntax

'Declaration
Public Function GetEnumerator As AnalysisWarningCollection.AnalysisWarningCollectionEnumerator
'Usage
Dim instance As AnalysisWarningCollection 
Dim returnValue As AnalysisWarningCollection.AnalysisWarningCollectionEnumerator 

returnValue = instance.GetEnumerator()
public AnalysisWarningCollection.AnalysisWarningCollectionEnumerator GetEnumerator()
public:
AnalysisWarningCollection.AnalysisWarningCollectionEnumerator^ GetEnumerator()
public function GetEnumerator() : AnalysisWarningCollection.AnalysisWarningCollectionEnumerator

Return Value

Type: System.Windows.Ink.AnalysisWarningCollection.AnalysisWarningCollectionEnumerator
Returns an object that implements the IEnumerator interface and that can iterate through the AnalysisWarning objects within the AnalysisWarningCollection.

Examples

The examples in this section show two ways to iterate through an AnalysisWarningCollection and get the AnalysisHintNode objects for each AnalysisWarning object.

The following example gets the IEnumerator for the AnalysisWarningCollection named warnings.

Dim hints As New ArrayList()
' Version using GetEnumerator() 
Dim ienum As IEnumerator = warnings.GetEnumerator()
While ienum.MoveNext()
    Dim hint As AnalysisHintNode = CType(ienum.Current, AnalysisWarning).AnalysisHint
    hints.Add(hint)
End While
ArrayList hints = new ArrayList();
// Version using GetEnumerator()
IEnumerator ienum = warnings.GetEnumerator();
while (ienum.MoveNext())
{
    AnalysisHintNode hint = ((AnalysisWarning)ienum.Current).AnalysisHint;
    hints.Add(hint);
}

The following example uses the foreach statement, which calls the GetEnumerator method in internal code, which the compiler generates to support the statement.

' Version using foreach 
For Each warning As AnalysisWarning In warnings
    Dim hint As AnalysisHintNode = warning.AnalysisHint
    hints.Add(hint)
Next warning
// Version using foreach 
foreach (AnalysisWarning warning in warnings)
{
    AnalysisHintNode hint = warning.AnalysisHint;
    hints.Add(hint);
}

Platforms

Windows 7, Windows Vista, Windows XP SP2, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003

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

See Also

Reference

AnalysisWarningCollection Class

AnalysisWarningCollection Members

System.Windows.Ink Namespace

AnalysisWarning