The problem is that you rely on a non-generic interface IEnumeratorthat does not show the actual type of the element (its property Currenthas a type object). Use a common interface ( IEnumerator<T>which makes the element type easily detectable) and everything will be fine.
, - . Dictionary<,> IEnumerable. "" GetEnumerator , ( , ), .
, .
using(var iterdico = mDico.GetEnumerator())
{
while (iterdico.MoveNext())
{
var kvp = iterdico.Current;
var key = kvp.Key;
var value = kvp.Value;
...
}
}
EDIT:
:
Dispose , using.Reset . , .- , - - , . , ,
Value. - ,
foreach , .