From 21f1e95fb8e935134a969bc3d729964d8d2aadfa Mon Sep 17 00:00:00 2001 From: Ben Harris Date: Thu, 14 May 2020 23:06:10 -0400 Subject: rename Irc to IRC --- IrcStates/Extensions.cs | 40 ---------------------------------------- 1 file changed, 40 deletions(-) delete mode 100644 IrcStates/Extensions.cs (limited to 'IrcStates/Extensions.cs') 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 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(this Dictionary dict, Dictionary other) - { - if (dict == null || other == null || !other.Any()) return; - - foreach (var (key, value) in other) dict[key] = value; - } - } -} -- cgit 1.4.1