Export (0) Print
Expand All

Lookup<TKey, TElement>.GetEnumerator Method

Returns a generic enumerator that iterates through the Lookup<TKey, TElement>.

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

public IEnumerator<IGrouping<TKey, TElement>> GetEnumerator()

Implements

IEnumerable<T>.GetEnumerator()

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


// Iterate through each Example in the Lookup and output the contents.
foreach (IGrouping<char, string> packageGroup in lookup)
{
   // Print the key value of the Example.
   outputBlock.Text += packageGroup.Key + "\n";
   // Iterate through each value in the Example and print its value.
   foreach (string str in packageGroup)
      outputBlock.Text += String.Format("    {0}", str) + "\n";
}


Silverlight

Supported in: 5, 4, 3

Silverlight for Windows Phone

Supported in: Windows Phone OS 7.1, Windows Phone OS 7.0

XNA Framework

Supported in: Xbox 360, Windows Phone OS 7.0

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.

Community Additions

ADD
Show:
© 2014 Microsoft