dotnet/runtime

Prefer Dictionary.Remove(key, out value) over Dictionary.this[key], followed by Dictionary.Remove(key)

Open

#33 800 ouverte le 19 mars 2020

Voir sur GitHub
 (7 commentaires) (0 réactions) (0 assignés)C# (5 445 forks)batch import
api-approvedarea-System.Collectionscode-analyzercode-fixerenhancementhelp wanted

Métriques du dépôt

Stars
 (17 886 stars)
Métriques de merge PR
 (Merge moyen 12j 11h) (661 PRs mergées en 30 j)

Description

Dictionary.ContainsKey<K, V(key), followed by Dictionary<K, V.this[key], followed by Dictionary<K, V>.Remove(key) can be combined into a single Remove call, using the overload accepting out TValue value.

Category: Performance

Guide contributeur