diff --git a/LLama/Extensions/DictionaryExtensions.cs b/LLama/Extensions/DictionaryExtensions.cs deleted file mode 100644 index 286a97ddb..000000000 --- a/LLama/Extensions/DictionaryExtensions.cs +++ /dev/null @@ -1,30 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace LLama.Extensions -{ - public static class DictionaryExtension - { - public static void Deconstruct(this KeyValuePair pair, out T1 first, out T2 second) - { - first = pair.Key; - second = pair.Value; - } - public static void Update(this Dictionary dic, IDictionary other) - { - foreach (var (key, value) in other) - { - dic[key] = value; - } - } - public static T2 GetOrDefault(this Dictionary dic, T1 key, T2 defaultValue) - { - if (dic.ContainsKey(key)) - { - return dic[key]; - } - return defaultValue; - } - } -} diff --git a/LLama/Extensions/KeyValuePairExtensions.cs b/LLama/Extensions/KeyValuePairExtensions.cs new file mode 100644 index 000000000..814e0a131 --- /dev/null +++ b/LLama/Extensions/KeyValuePairExtensions.cs @@ -0,0 +1,24 @@ +using System.Collections.Generic; + +namespace LLama.Extensions +{ + /// + /// Extensions to the KeyValuePair struct + /// + public static class KeyValuePairExtensions + { + /// + /// Deconstruct a KeyValuePair into it's constituent parts. + /// + /// The KeyValuePair to deconstruct + /// First element, the Key + /// Second element, the Value + /// Type of the Key + /// Type of the Value + public static void Deconstruct(this KeyValuePair pair, out TKey first, out TValue second) + { + first = pair.Key; + second = pair.Value; + } + } +}