IRC parsing, tokenization, and state handling in C#
at ircrobots 22 lines 708 B view raw
1using System.Collections.Generic; 2using System.Linq; 3 4namespace IRCStates 5{ 6 public static class Extensions 7 { 8 /// <summary> 9 /// Update the dictionary with <see cref="other"/>'s keys and values 10 /// </summary> 11 /// <param name="dict"></param> 12 /// <param name="other"></param> 13 /// <typeparam name="TKey"></typeparam> 14 /// <typeparam name="TValue"></typeparam> 15 public static void UpdateWith<TKey, TValue>(this Dictionary<TKey, TValue> dict, Dictionary<TKey, TValue> other) 16 { 17 if (dict == null || other == null || !other.Any()) return; 18 19 foreach (var (key, value) in other) dict[key] = value; 20 } 21 } 22}