dotnet/runtime

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

Open

#33,800 建立於 2020年3月19日

在 GitHub 查看
 (7 留言) (0 反應) (0 負責人)C# (5,445 fork)batch import
api-approvedarea-System.Collectionscode-analyzercode-fixerenhancementhelp wanted

倉庫指標

Star
 (17,886 star)
PR 合併指標
 (平均合併 12天 11小時) (30 天內合併 661 個 PR)

描述

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

貢獻者指南