The Dictionary class throws an exception when you index-access an item that does not exist.
var dictionary = new Dictionary<string, string>();
var value = dictionary["Hello"]; // throws KeyNotFoundException: The given key was not present in the dictionary
We would like a method that would return null instead of throwing an exception.
The Dictionary class throws an exception when you index-access an item that does not exist.
We would like a method that would return null instead of throwing an exception.