In Java, it is possible to increase or decrease numeric value in one line while adding an element to a hashmap. Is there any way to do it in C# Dictionary?
For example in Java:
hashMap.put(key, hashMap.getOrDefault(key, 0) +1);
in C#:
if (dictionary.ContainsKey(key)) dictionary[key]++;
else dictionary.Add(key, 1);