check if object has method with signature of delegate
c#, delegates
Solution
You can do that by locating all methods in the type having the same return type, and the same sequence of types in the parameters:
var matchingMethods = o.GetType().GetMethods().Where(mi =>
mi.ReturnType == gs.Method.ReturnType
&& mi.GetParameters().Select(pi => pi.ParameterType)
.SequenceEqual(gs.Method.GetParameters().Select(pi => pi.ParameterType)));
Problem
How can I check if a object has a method with the same signature of a specific delegate ``` public delegate T GetSomething<T>(int aParameter); public static void Method<T>(object o, GetSomething<T> gs) { //check if 'o' has a method with the signature of 'gs' } ```