GetEnumerator Method
Collapse the table of content
Expand the table of content

Lookup(Of TKey, TElement).GetEnumerator Method

[ This article is for Windows Phone 8 developers. If you’re developing for Windows 10, see the latest documentation. ]

Returns a generic enumerator that iterates through the Lookup(Of TKey, TElement).

Namespace:  System.Linq
Assembly:  System.Core (in System.Core.dll)

'Declaration
Public Function GetEnumerator As IEnumerator(Of IGrouping(Of TKey, TElement))

Implements

IEnumerable(Of T).GetEnumerator

The following example demonstrates how to use GetEnumerator to iterate through the keys and values of a Lookup(Of TKey, TElement). This code example is part of a larger example provided for the Lookup(Of TKey, TElement) class.


Dim output As New System.Text.StringBuilder
' Iterate through each Example in the Lookup and output the contents.
For Each packageGroup As IGrouping(Of Char, String) In lookup
   ' Print the key value of the Example.
   output.AppendLine(packageGroup.Key)
   ' Iterate through each value in the Example and print its value.
   For Each str As String In packageGroup
      output.AppendLine(String.Format("    {0}", str))
   Next
Next

' Display the output.
outputBlock.Text &= output.ToString() & vbCrLf


Windows Phone OS

Supported in: 8.1, 8.0, 7.1, 7.0

Windows Phone

Show:
© 2017 Microsoft