Проверка MethodInfo для делегата
Как я могу определить, соответствует ли MethodInfo отдельному типу делегата?
bool IsMyDelegate(MethodInfo method);
Изменить: я получил объект MethodInfo и хочу знать, соответствует ли он интерфейсу делегата. Помимо очевидного
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;
}