Ejemplo n.º 1
0
 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);
 }
Ejemplo n.º 2
0
 public CalcResult <T> Decrement()
 {
     if (IsValid)
     {
         try
         {
             _value = Arithmetic <T> .Decrement(_value);
         }
         catch (Exception e)
         {
             Message = e.Message;
             IsValid = false;
         }
     }
     return(this);
 }
Ejemplo n.º 3
0
 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);
 }
Ejemplo n.º 4
0
 public static T Multiply <T>(T x, T y) => Arithmetic <T> .Multiply(x, y);
Ejemplo n.º 5
0
 public static T Subtract <T>(T x, T y) => Arithmetic <T> .Subtract(x, y);
Ejemplo n.º 6
0
 public static T Add <T>(T x, T y) => Arithmetic <T> .Add(x, y);
Ejemplo n.º 7
0
 public static T Decrement <T>(ref T x) => x = Arithmetic <T> .Decrement(x);
Ejemplo n.º 8
0
 public static T Decrement <T>(T x) => Arithmetic <T> .Decrement(x);
Ejemplo n.º 9
0
 public static T Increment <T>(ref T x) => x = Arithmetic <T> .Increment(x);
Ejemplo n.º 10
0
 public static T Increment <T>(T x) => Arithmetic <T> .Increment(x);
Ejemplo n.º 11
0
 public static T Divide <T>(T x, T y) => Arithmetic <T> .Divide(x, y);
Ejemplo n.º 12
0
 public static T Decrement <T>(this ref T x) where T : struct => x = Arithmetic <T> .Decrement(x);