Forum Discussion
fayrehouse
13 years agoFrequent Contributor
Again this was one of those situations where I battled with it for hours, posted the question here, THEN found the answer ;-)...
For those of you wanting to battle dictionaries, which have no indices (preventing the 0..n approach), and since we have no for each equivalent - you might find something like this does the job:
var enumerator = xobj.Keys.GetEnumerator();
while (enumerator.MoveNext())
{
var name = enumerator.Current;
var obj = xobj.Get(name);
.....
}
For those of you wanting to battle dictionaries, which have no indices (preventing the 0..n approach), and since we have no for each equivalent - you might find something like this does the job:
var enumerator = xobj.Keys.GetEnumerator();
while (enumerator.MoveNext())
{
var name = enumerator.Current;
var obj = xobj.Get(name);
.....
}