dotnet/runtime

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

オープン

#33,800 opened on 2020/03/19

 (7 件のコメント) (0 件のリアクション) (0 人の担当者)C# (5,445 件のフォーク)batch import
api-approvedarea-System.Collectionscode-analyzercode-fixerenhancementhelp wanted

Repository metrics

Stars
 (17,886 個のスター)
PR merge metrics
 (平均マージ 12d 11h) (30d で 661 merged PRs)

説明

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

コントリビューターガイド