Iterating over CssStyleCollection
<p>I'm trying to iterate over the Style property of a control in ASP.NET. This is of type CssStyleCollection, which has a reference page on <a href="http://msdn.microsoft.com/en-us/library/system.web.ui.cssstylecollection.aspx" rel="nofollow">MSDN</a>.</p>

<p>There is some sample code on that page for iterating through the collection and getting both the keys and values for each item in the collection. It looks like this:</p>

<pre><code>IEnumerator keys = MyText.Style.Keys.GetEnumerator();

while (keys.MoveNext())
{
  String key = (String)keys.Current;
  dr = dt.NewRow();
  dr[0] = key;
  dr[1] = MyText.Style[key];
  dt.Rows.Add(dr);
}
</code></pre>

<p>I've tried using the first line in my code, but the compiler keeps saying that I need to specify a type argument for the generic type IEnumerator. Given that I'm trying to use sample code from Microsoft itself, I'm a bit confused!</p>

<p>Is anyone able to help me with iterating through a CssStyleCollection?</p>
