mirror of
https://github.com/ICDSystems/ICD.Common.Utils.git
synced 2026-04-12 12:07:05 +00:00
perf: Micro-optimizations
This commit is contained in:
parent
e8ce1e94cc
commit
69b97779d9
1 changed files with 4 additions and 2 deletions
|
|
@ -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;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue