23 lines
708 B
C#
23 lines
708 B
C#
using System.Collections.Generic;
|
|
using System.Linq;
|
|
|
|
namespace IRCStates
|
|
{
|
|
public static class Extensions
|
|
{
|
|
/// <summary>
|
|
/// Update the dictionary with <see cref="other"/>'s keys and values
|
|
/// </summary>
|
|
/// <param name="dict"></param>
|
|
/// <param name="other"></param>
|
|
/// <typeparam name="TKey"></typeparam>
|
|
/// <typeparam name="TValue"></typeparam>
|
|
public static void UpdateWith<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;
|
|
}
|
|
}
|
|
}
|