//adds entry to dictionary if it doesn't exist //updates it if it does public static void AddOrUpdateDictionaryEntry(Dictionary<Totem, int> dict, Totem key) { var k = dict.Keys.ToList().Find(x=>x.nid == key.nid); if (k != null) dict[k]++; else dict.Add(key, 1); }
//adds entry to dictionary if it doesn't exist //updates it if it does public static void AddOrUpdateDictionaryEntry(Dictionary <Totem, int> dict, Totem key) { var k = dict.Keys.ToList().Find(x => x.nid == key.nid); if (k != null) { dict[k]++; } else { dict.Add(key, 1); } }