Пример #1
0
        public override ISCType Subtract(ISCType obj)
        {
            if (obj.IsOfType <SC_Int, SC_Long>())
            {
                return(new SC_Long(value - obj.GetValueAs <long>()));
            }

            throw new ArgumentException($"you cant subtract {obj.GetType()} to a long");
        }
Пример #2
0
        public override ISCType Multiply(ISCType obj)
        {
            if (obj.IsOfType <SC_Int, SC_Long>())
            {
                return(new SC_Long(value * obj.GetValueAs <long>()));
            }

            throw new ArgumentException($"you cant multiply {obj.GetType()} to a long");
        }
Пример #3
0
        public override ISCType Add(ISCType obj)
        {
            if (obj.IsOfType <SC_Int, SC_Long>())
            {
                return(new SC_Long(value + obj.GetValueAs <long>()));
            }

            if (obj.IsOfType <SC_String>())
            {
                return(new SC_String(value + obj.GetValueAs <string>()));
            }

            throw new ArgumentException($"you cant add {obj.GetType()} to a long");
        }
Пример #4
0
 public static bool IsOfType <T>(this ISCType obj) where T : ISCType
 {
     return(obj.GetType() == typeof(T));
 }
Пример #5
0
 public static bool IsOfType <T1, T2>(this ISCType obj) where T1 : ISCType where T2 : ISCType
 {
     return(obj.GetType() == typeof(T1) || obj.GetType() == typeof(T2));
 }