diff options
Diffstat (limited to 'IrcStates/Extensions.cs')
-rw-r--r-- | IrcStates/Extensions.cs | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/IrcStates/Extensions.cs b/IrcStates/Extensions.cs index dde0edb..e604928 100644 --- a/IrcStates/Extensions.cs +++ b/IrcStates/Extensions.cs @@ -1,4 +1,5 @@ using System; +using System.Collections.Generic; using System.Linq; using System.Linq.Expressions; using System.Reflection; @@ -28,5 +29,12 @@ namespace IrcStates ? Delegate.CreateDelegate(getType(types.ToArray()), methodInfo) : Delegate.CreateDelegate(getType(types.ToArray()), target, methodInfo); } + + public static void Update<TKey, TValue>(this Dictionary<TKey, TValue> dict, Dictionary<TKey, TValue> other) + { + if (dict == null || other == null || !other.Any()) return; + + foreach (var (key, value) in other) dict[key] = value; + } } } |