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"); }
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"); }
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"); }
public static bool IsOfType <T>(this ISCType obj) where T : ISCType { return(obj.GetType() == typeof(T)); }
public static bool IsOfType <T1, T2>(this ISCType obj) where T1 : ISCType where T2 : ISCType { return(obj.GetType() == typeof(T1) || obj.GetType() == typeof(T2)); }