void AddMultiplesToDictionary(string key, double value, int quantity) { if (!MultipleKeyDict.ContainsKey(key)) { MultipleKeyDict.Add(key, 0); } for (var i = 0; i < quantity; i++) { MultipleKeyDict[key]++; var mainDictKey = key + MultipleKeyDict[key]; ErrorReporter.ReportDebug(ContainsKey(mainDictKey), $"This Key should be free. Key:{mainDictKey}"); Update(mainDictKey, value); } }
void RemoveMulitpleFromDictionary(string key, double value, int quantity) { if (!MultipleKeyDict.ContainsKey(key)) { ErrorReporter.ReportDebug($"Can't remove something that never existed. Key:{key}"); return; } for (var i = 0; i > quantity; i--) { var mainDictKey = key + MultipleKeyDict[key]; ErrorReporter.ReportDebug(MultipleKeyDict[key] == 0, $"Zero Keys shouldn't exist, we shouldn't try to remove them. Key={key}, quantity={quantity}, i={i}"); ErrorReporter.ReportDebug(!ContainsKey(mainDictKey), $"We shouldn't be trying to remove values that don't exist Key={key}, quantity={quantity}, i={i}"); if (ContainsKey(mainDictKey)) { Remove(mainDictKey); MultipleKeyDict[key]--; } } }