fix: Use IDictionary.GetEnumerator explicitly to iterate keyvals

We really need to replace these old non-generic collections with generic ones.
BlueRow's IDictionaryEnumerator implementation iterates over values when passed
to a foreach loop, not key value pairs.
This commit is contained in:
John Colvin committed 2025-11-15 12:38:49 -05:00
1 parent f07d83e7bb
commit 57b82cf10d
2 files changed
+12 -3

No files matched your search

@@ -88,9 +88,16 @@ namespace BCG
public BlueRow(IBlueTableSchema schema, IDictionary row)
{
myInit(schema);
foreach (DictionaryEntry de in row)
if (mySchema[de.Key as string] != null)
// Use GetEnumerator instead of a foreach loop because the latter calls
// '((IEnumerator)row).GetEnumerator()', which iterates over values
// instead of key value pairs.
var en = row.GetEnumerator();
while (en.MoveNext()) {
var de = en.Entry;
if (mySchema[de.Key as string] is not null) {
myValues[mySchema[de.Key as string].colNo] = de.Value;
}
}
}
/// <summary>