How to change value by key in Dictionary in C#?
Hello everyone! I'm a beginner in C# and working on a project where I need to store user data in Dictionary. I have a dictionary that stores user names and their scores:\n\n```csharp\nDictionary scores = new Dictionary\n{\n { "Alice", 150 },\n { "Bob", 200 },\n { "Charlie", 175 }\n};\n```\n\nNow I need to update the score for user "Bob" — increase from 200 to 250. I tried doing this:\n\n```csharp\nscores["Bob"] = 250;\n```\n\nBut I'm not sure if this is the correct way. What if the key "Bob" doesn't exist in the dictionary? Will an exception be thrown? Is there a safer way to update the value to avoid errors? I'm also interested if it's possible to update the value only if the key already exists, and not add