You need the value for a key only if it exists, without throwing. Which approach is correct and safe?var scores = new Dictionary<string, int>(); // ...