From b3fdc4bb9602881fe908a27d479d385b0ff0cab6 Mon Sep 17 00:00:00 2001 From: AT <14300910+theClueless@users.noreply.github.com> Date: Tue, 3 Dec 2019 23:37:55 +0200 Subject: [PATCH] updated user selected record --- Wox/Storage/UserSelectedRecord.cs | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/Wox/Storage/UserSelectedRecord.cs b/Wox/Storage/UserSelectedRecord.cs index 9005590410..ef8bf7f8ef 100644 --- a/Wox/Storage/UserSelectedRecord.cs +++ b/Wox/Storage/UserSelectedRecord.cs @@ -12,21 +12,23 @@ namespace Wox.Storage public void Add(Result result) { - if (records.ContainsKey(result.ToString())) + var key = result.ToString(); + if (records.TryGetValue(key, out int value)) { - records[result.ToString()] += 1; + records[key] = value + 1; } else { - records.Add(result.ToString(), 1); + records.Add(key, 1); + } } public int GetSelectedCount(Result result) { - if (records.ContainsKey(result.ToString())) + if (records.TryGetValue(result.ToString(), out int value)) { - return records[result.ToString()]; + return value; } return 0; }