mirror of
https://github.com/ICDSystems/ICD.Common.Utils.git
synced 2026-02-08 09:15:10 +00:00
perf: Micro-optimizations
This commit is contained in:
@@ -98,7 +98,8 @@ namespace ICD.Common.Utils.Extensions
|
||||
if (key == null)
|
||||
throw new ArgumentNullException("key");
|
||||
|
||||
return extends.ContainsKey(key) ? extends[key] : defaultValue;
|
||||
TValue value;
|
||||
return extends.TryGetValue(key, out value) ? value : defaultValue;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -229,7 +230,8 @@ namespace ICD.Common.Utils.Extensions
|
||||
|
||||
foreach (KeyValuePair<TKey, TValue> pair in other)
|
||||
{
|
||||
if (extends.ContainsKey(pair.Key) && comparer.Equals(pair.Value, extends[pair.Key]))
|
||||
TValue value;
|
||||
if (extends.TryGetValue(pair.Key, out value) && comparer.Equals(pair.Value, value))
|
||||
continue;
|
||||
|
||||
extends[pair.Key] = pair.Value;
|
||||
|
||||
Reference in New Issue
Block a user