I can't for the life of me figure out why the legacy code is doing this:
HashSiteMapping.Add(""+sm.SiteNumber, sm.LocationNumber);
...when this seems more sensible:
HashSiteMapping.Add(sm.SiteNumber, sm.LocationNumber);
I would just shrug my shoulders and chock it up to the general bizarreness of this code, but I'm getting "value does not fall within the expected range" in this code and am wondering if that might be the problem. In fuller context, the code was this:
IEnumerator en = mFile.Map.Mappings.GetEnumerator();
while (en.MoveNext())
{
SiteMapping sm = (SiteMapping) en.Current;
HashSiteMapping.Add(""+sm.SiteNumber, sm.LocationNumber);
}
...and I changed it to this:
IEnumerator en = mFile.Map.Mappings.GetEnumerator();
while (en.MoveNext())
{
SiteMapping sm = (SiteMapping) en.Current;
if (!HashSiteMapping.Contains(sm.SiteNumber))
{
HashSiteMapping.Add(sm.SiteNumber, sm.LocationNumber);
}
}
...but I still get, "value does not fall within the expected range"