0
我从ConcurrentDictionary中获得了一个IEnumerator类型。我想通过它来循环使用以下方式如何遍历此IEnumerator
System.Collections.Generic.IEnumerator<System.Collections.Generic.KeyValuePair<string,string>>
Ien = Concur_Dictionary.GetEnumerator();
foreach (KeyValuePair<string, string> pair in Ien) -->Error here
{
}
我收到以下错误
Error 4 foreach statement cannot operate on variables of type 'System.Collections.Generic.IEnumerator<System.Collections.Generic.KeyValuePair<string,string>>' because 'System.Collections.Generic.IEnumerator<System.Collections.Generic.KeyValuePair<string,string>>' does not contain a public definition for 'GetEnumerator'
上我能如何通过这个IEnumerator的迭代有什么建议?
那么在这种情况下,这很重要。由于它的线程安全。所以我需要遍历IEnumerator – MistyD 2013-02-20 08:23:17
@MistyD:'foreach'语句在后台调用'GetEnumerator()'。 – 2013-02-20 08:26:04
感谢您的支持 – MistyD 2013-02-20 08:29:07