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