Q: Is there a way to shorten this code: (Add key to dictionary if key doesn't exist)? if (dict.ContainsKey(key))
{
     dict[key] = value;
}
else
{
     dict.Add(key, value);
}

This is kind of verbose and I'm wondering if there is a magical function out there that can reduce this to 1 or 2 lines of code. Please teach me magic.

A: This is already the behaviour of the dictionary's index operator:
dict[key] = value;

Is all you need.
