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