private static bool CheckMethod(MethodInfo method, MethodInfo propertyMethod)
{
if (method.Equals(propertyMethod))
{
return true;
}
// If the type is an interface then the handle for the method got by the compiler will not be the
// same as that returned by reflection.
// Check for this condition and try and get the method from reflection.
Type type = method.DeclaringType;
if (type.GetTypeInfo().IsInterface && method.Name == propertyMethod.Name && type.GetMethod(method.Name) == propertyMethod)
{
return true;
}
return false;
}