We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ContainsKey
TryGetValue
A call to ContainsKey(key) followed by an access var set = this[key] results in a double lookup in the dictionary.
ContainsKey(key)
var set = this[key]
Resolution: Replace ContainsKey with TryGetValue.
The code can also be simplified by using collection initializers.
See also: CA1854: Prefer the IDictionary.TryGetValue(TKey, out TValue) method.
The text was updated successfully, but these errors were encountered:
Successfully merging a pull request may close this issue.
A call to
ContainsKey(key)
followed by an accessvar set = this[key]
results in a double lookup in the dictionary.Resolution: Replace
ContainsKey
withTryGetValue
.The code can also be simplified by using collection initializers.
See also: CA1854: Prefer the IDictionary.TryGetValue(TKey, out TValue) method.
The text was updated successfully, but these errors were encountered: