diff --git a/Core/Extensions/ReflectionExtensions.cs b/Core/Extensions/ReflectionExtensions.cs
index 90fe6d9e..470ee937 100644
--- a/Core/Extensions/ReflectionExtensions.cs
+++ b/Core/Extensions/ReflectionExtensions.cs
@@ -378,6 +378,16 @@ namespace Vanara.Extensions
}
#endif
+ /// Determines whether the specified method is compatible with a delegate.
+ /// The type of the delegate.
+ /// The method information.
+ /// if method is compatible with the delegate; otherwise, .
+ public static bool IsMethodCompatibleWithDelegate(this MethodInfo method) where TDel : Delegate
+ {
+ var delegateSignature = typeof(TDel).GetMethod("Invoke");
+ return delegateSignature.ReturnType == method.ReturnType && delegateSignature.GetParameters().Select(x => x.ParameterType).SequenceEqual(method.GetParameters().Select(x => x.ParameterType));
+ }
+
/// Loads a type from a named assembly.
/// Name of the type.
/// The name or path of the file that contains the manifest of the assembly.