Exemple #1
0
 private void setOperators()
 {
     if (operators == null)
     {
         Type datatype = typeof(U);
         if (datatype == typeof(double))
         {
             operators = (IMathOperators <U>) new DoubleOperators();
         }
         else if (datatype == typeof(float))
         {
             operators = (IMathOperators <U>) new FloatOperators();
         }
         else if (datatype == typeof(int))
         {
             operators = (IMathOperators <U>) new IntOperators();
         }
         else
         {
             throw new NotImplementedException("Datatype unknown for math operators");
         }
     }
 }