Exemplo n.º 1
0
 //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);
 }
Exemplo n.º 2
0
        //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);
            }
        }