Code inspection: Dictionary item removal can be simplified with single 'Remove'
Last modified: 23 July 2024tip
The Remove
method in Dictionary<T, T>
in C# does not throw an exception if the key is not found, it simply returns false
. This means you do not need to use TryGetValue
to check if the key exists in the dictionary before trying to remove it.