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
@MistyD :'foreach' 문은 장면 뒤에서'GetEnumerator()'를 호출한다. –
해당 사항을 해결해 주셔서 감사합니다. – MistyD