roslynator
roslynator copied to clipboard
Feature Request: TryGetValue with discard out parameter
trafficstars
An analyzer could detect this pattern:
dictionary.TryGetValue(key, out var _)
and suggest to turn it to
dictionary.ContainsKey(key)
This can possibly be extended to other similar methods in the .NET Framework which have better equivalent if you discard the out parameter)
(and not just TryGetValue methods, possibly other signature as well..)