diff --git a/ICD.Common.Utils/Extensions/EventHandlerExtensions.cs b/ICD.Common.Utils/Extensions/EventHandlerExtensions.cs index 6e222db..824a886 100644 --- a/ICD.Common.Utils/Extensions/EventHandlerExtensions.cs +++ b/ICD.Common.Utils/Extensions/EventHandlerExtensions.cs @@ -1,4 +1,9 @@ using System; +#if SIMPLSHARP +using Crestron.SimplSharp.Reflection; +#else +using System.Reflection; +#endif namespace ICD.Common.Utils.Extensions { @@ -34,5 +39,22 @@ namespace ICD.Common.Utils.Extensions if (extends != null) extends(sender, args); } + + /// + /// Cross-platform shim for getting MethodInfo for the delegate. + /// + /// + /// + public static MethodInfo GetMethodInfo(this Delegate extends) + { + if (extends == null) + throw new ArgumentNullException("extends"); + +#if SIMPLSHARP + return extends.GetMethod(); +#else + return extends.Method; +#endif + } } }