How can I determine if a MethodInfo fits a distinct Delegate Type?
bool IsMyDelegate(MethodInfo method);
Edit: I'm given a MethodInfo object and want to know if it fits the delegate interface. Apart from the obvious
private bool IsValidationDelegate(MethodInfo method)
{
var result = false;
var parameters = method.GetParameters();
if (parameters.Length == 2 &&
parameters[0].ParameterType == typeof(MyObject1) &&
parameters[1].ParameterType == typeof(MyObject2) &&
method.ReturnType == typeof(bool))
{
result = true;
}
else
{
m_Log.Error("Validator:IsValidationDelegate", "Method [...] is not a ValidationDelegate.");
}
return result;
}