Type of a generic enumerator?

  • Thread starter Thread starter K.K.
  • Start date Start date
K

K.K.

I have an instance of type Dictionary<int, string>. What is the type of the
enumerator returned by GetEnumerator()? In other words, how would I fill in
this blank:

Dictionary<int, string> myDictionary = new Dictionary<int, string>();
_____(?)_____ en = myDictionary.GetEnumerator();
 
K.K. said:
I have an instance of type Dictionary<int, string>. What is the type of the
enumerator returned by GetEnumerator()? In other words, how would I fill in
this blank:

Dictionary<int, string> myDictionary = new Dictionary<int, string>();
_____(?)_____ en = myDictionary.GetEnumerator();

KeyValuePair<int,string>
 
Mattias Sjogren said:
I think you mean

Dictionary<int, string>.Enumerator

or

IEnumerator<KeyValuePair<int, string>>

Oops, yes.
I thought that was a foreach line, -_-
 
Back
Top