ReSharper
 
Get ReSharper
Get your hands on the new features ahead of the release by joining the Early Access Program for ReSharper 2025.1! Learn more

Code inspection: Dictionary lookup can be simplified with 'GetValueOrDefault'

Last modified: 04 June 2024

If you use the Dictionary.TryGetValue() method and fall back to some default value if the key is not found, ReSharper suggest using the dedicated CollectionExtensions.GetValueOrDefault() method instead to improve the structure and readability of your code.