Exemple #1
0
 [DebuggerStepThrough] public static Unit <T> operator -(Unit <T> lhs, Unit <T> rhs)
 {
     // Allow subtract with scalar zero
     if (rhs.IsScalarZero)
     {
         return(lhs);
     }
     if (lhs.IsScalarZero)
     {
         return(-rhs);
     }
     if (lhs.UnitId != rhs.UnitId)
     {
         throw new Exception("Unit types don't match");
     }
     return(new Unit <T>(Operators <T> .Sub(lhs.Value, rhs.Value), lhs.UnitId));
 }
Exemple #2
0
 [DebuggerStepThrough] public static Unit <T> operator -(Unit <T> lhs, T rhs)
 {
     return(new Unit <T>(Operators <T> .Sub(lhs.Value, rhs), lhs.UnitId));
 }