From 8311fe5c9d95b7bc5a576d30778bb7552e39cd15 Mon Sep 17 00:00:00 2001 From: Chris Cameron Date: Tue, 6 Nov 2018 15:45:43 -0500 Subject: [PATCH] perf: Micro-optimization --- ICD.Common.Utils/Extensions/DictionaryExtensions.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/ICD.Common.Utils/Extensions/DictionaryExtensions.cs b/ICD.Common.Utils/Extensions/DictionaryExtensions.cs index 3cb4e26..5f29f97 100644 --- a/ICD.Common.Utils/Extensions/DictionaryExtensions.cs +++ b/ICD.Common.Utils/Extensions/DictionaryExtensions.cs @@ -125,8 +125,10 @@ namespace ICD.Common.Utils.Extensions if (key == null) throw new ArgumentNullException("key"); - extends[key] = extends.GetDefault(key, defaultValue); - return extends[key]; + TValue value = extends.GetDefault(key, defaultValue); + extends[key] = value; + + return value; } ///