private static MethodInfo GetUserDefinedBinaryOperator(ExpressionType binaryType, Type leftType, Type rightType, string name)
{
// This algorithm is wrong, we should be checking for uniqueness and erroring if
// it is defined on both types.
Type[] types = new Type[] { leftType, rightType };
Type nnLeftType = leftType.GetNonNullableType();
Type nnRightType = rightType.GetNonNullableType();
MethodInfo method = nnLeftType.GetAnyStaticMethodValidated(name, types);
if (method == null && !TypeUtils.AreEquivalent(leftType, rightType))
{
method = nnRightType.GetAnyStaticMethodValidated(name, types);
}
if (IsLiftingConditionalLogicalOperator(leftType, rightType, method, binaryType))
{
method = GetUserDefinedBinaryOperator(binaryType, nnLeftType, nnRightType, name);
}
return method;
}