public static BinaryExpression Divide(Expression left, Expression right, MethodInfo method)
{
RequiresCanRead(left, nameof(left));
RequiresCanRead(right, nameof(right));
if (method == null)
{
if (left.Type == right.Type && left.Type.IsArithmetic())
{
return new SimpleBinaryExpression(ExpressionType.Divide, left, right, left.Type);
}
return GetUserDefinedBinaryOperatorOrThrow(ExpressionType.Divide, "op_Division", left, right, liftToNull: true);
}
return GetMethodBasedBinaryOperator(ExpressionType.Divide, left, right, method, liftToNull: true);
}