How to update the value stored in Dictionary in C#?

Amit picture Amit · Aug 7, 2009 · Viewed 593.1k times · Source

How to update value for a specific key in a dictionary Dictionary<string, int>?

Answer

ccalboni picture ccalboni · Aug 7, 2009

Just point to the dictionary at given key and assign a new value:

myDictionary[myKey] = myNewValue;