public CalcResult <T> Divide(T a) { if (IsValid) { try { _value = Arithmetic <T> .Divide(_value, a); } catch (Exception e) { Message = e.Message; IsValid = false; } } return(this); }
public CalcResult <T> Decrement() { if (IsValid) { try { _value = Arithmetic <T> .Decrement(_value); } catch (Exception e) { Message = e.Message; IsValid = false; } } return(this); }
public CalcResult <T> Add(CalcResult <T> cr) { if (IsValid) { if (cr.IsValid) { try { _value = Arithmetic <T> .Add(_value, cr._value); } catch (Exception e) { Message = e.Message; IsValid = false; } } else { return(cr); } } return(this); }
public static T Multiply <T>(T x, T y) => Arithmetic <T> .Multiply(x, y);
public static T Subtract <T>(T x, T y) => Arithmetic <T> .Subtract(x, y);
public static T Add <T>(T x, T y) => Arithmetic <T> .Add(x, y);
public static T Decrement <T>(ref T x) => x = Arithmetic <T> .Decrement(x);
public static T Decrement <T>(T x) => Arithmetic <T> .Decrement(x);
public static T Increment <T>(ref T x) => x = Arithmetic <T> .Increment(x);
public static T Increment <T>(T x) => Arithmetic <T> .Increment(x);
public static T Divide <T>(T x, T y) => Arithmetic <T> .Divide(x, y);
public static T Decrement <T>(this ref T x) where T : struct => x = Arithmetic <T> .Decrement(x);