M
Mike
I am trying to utilize Hashtable to facilitate mapping one value to
another. I have successfully added several such pairs. When using the
enumerators to find keys upon subsequent manipulation, I get the
following error. Any ideas why this is? Maybe I didn't initialize the
table properly?
An unhandled exception of type 'System.InvalidOperationException'
occurred in mscorlib.dll
Additional information: Collection was modified; enumeration operation
may not execute.
My code is thusly:
if (this->m_registryKey)
{
IEnumerator* keyEnum
= this->m_stringDict->Keys->GetEnumerator();
while (keyEnum->MoveNext())
{
String* strValue;
String* strKey = __try_cast<String*>(keyEnum->Current);
if (strValue = __try_cast<String*>(
this->m_registryKey->GetValue(strKey)))
{
this->Value[strKey] = strValue;
}
else
{
this->m_registryKey->SetValue(
strKey, this->m_stringDict->Item[strKey]);
}
}
}
another. I have successfully added several such pairs. When using the
enumerators to find keys upon subsequent manipulation, I get the
following error. Any ideas why this is? Maybe I didn't initialize the
table properly?
An unhandled exception of type 'System.InvalidOperationException'
occurred in mscorlib.dll
Additional information: Collection was modified; enumeration operation
may not execute.
My code is thusly:
if (this->m_registryKey)
{
IEnumerator* keyEnum
= this->m_stringDict->Keys->GetEnumerator();
while (keyEnum->MoveNext())
{
String* strValue;
String* strKey = __try_cast<String*>(keyEnum->Current);
if (strValue = __try_cast<String*>(
this->m_registryKey->GetValue(strKey)))
{
this->Value[strKey] = strValue;
}
else
{
this->m_registryKey->SetValue(
strKey, this->m_stringDict->Item[strKey]);
}
}
}