Exemplo n.º 1
0
        public static int GetNumberOfArguments(this OverloadableCodeOperator source)
        {
            if (source == OverloadableCodeOperator.TrueOperator || source == OverloadableCodeOperator.FalseOperator)
            {
                return(0);
            }

            if (source.IsOneOf(Unary))
            {
                return(1);
            }

            if (source.IsOneOf(Binary))
            {
                return(2);
            }

            throw new ArgumentOutOfRangeException(nameof(source), source, null);
        }
Exemplo n.º 2
0
 public static OverloadableCodeUnarySymmetricOperator ToUnarySymmetricOperator(this OverloadableCodeOperator source)
 {
     return(source.IsOneOf(Unary | Symmetric)
                         ? (OverloadableCodeUnarySymmetricOperator)source
                         : throw new ArgumentException($"The {source} is not unary symmetric operator.", nameof(source)));
 }