diff options
author | Ben Harris <ben@tilde.team> | 2020-05-14 23:06:10 -0400 |
---|---|---|
committer | Ben Harris <ben@tilde.team> | 2020-05-14 23:17:47 -0400 |
commit | 21f1e95fb8e935134a969bc3d729964d8d2aadfa (patch) | |
tree | db2be27e9b5ac48e19f92b56cbad68ab59f7099e /IrcStates/Extensions.cs | |
parent | 304df7805b9925c2edd992fd4177eef80197f807 (diff) |
rename Irc to IRC
Diffstat (limited to 'IrcStates/Extensions.cs')
-rw-r--r-- | IrcStates/Extensions.cs | 40 |
1 files changed, 0 insertions, 40 deletions
diff --git a/IrcStates/Extensions.cs b/IrcStates/Extensions.cs deleted file mode 100644 index 181ac80..0000000 --- a/IrcStates/Extensions.cs +++ /dev/null @@ -1,40 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Linq.Expressions; -using System.Reflection; - -namespace IrcStates -{ - public static class Extensions - { - public static Delegate CreateDelegate(this MethodInfo methodInfo, object target) - { - if (methodInfo == null) return null; - - var types = methodInfo.GetParameters().Select(p => p.ParameterType); - - Func<Type[], Type> getType; - if (methodInfo.ReturnType == typeof(void)) - { - getType = Expression.GetActionType; - } - else - { - getType = Expression.GetFuncType; - types = types.Concat(new[] {methodInfo.ReturnType}); - } - - return methodInfo.IsStatic - ? Delegate.CreateDelegate(getType(types.ToArray()), methodInfo) - : Delegate.CreateDelegate(getType(types.ToArray()), target, methodInfo); - } - - 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; - } - } -} |