Ejemplo n.º 1
0
 public static void InRange <T>(
     T value,
     [NotNull, InvokerParameterName] string argName,
     T fromValue, T toValue)
 {
     if (Operators <T> .LessThan(value, fromValue) || Operators <T> .GreaterThan(value, toValue))
     {
         throw CodeExceptions.ArgumentOutOfRange(argName, value, fromValue, toValue);
     }
 }
Ejemplo n.º 2
0
 public static void InRange(
     int value,
     [NotNull, InvokerParameterName] string argName,
     int fromValue, int toValue)
 {
     if (value < fromValue || value > toValue)
     {
         throw CodeExceptions.ArgumentOutOfRange(argName, value, fromValue, toValue);
     }
 }
Ejemplo n.º 3
0
 public static void InRange <T>(
     [NotNull] T value,
     [NotNull, InvokerParameterName] string argName,
     [NotNull] T fromValue,
     [NotNull] T toValue)
 {
     // DONTTOUCH: handles the NaN values
     if (!(Operators <T> .GreaterThanOrEqual(value, fromValue) && Operators <T> .LessThanOrEqual(value, toValue)))
     {
         throw CodeExceptions.ArgumentOutOfRange(argName, value, fromValue, toValue);
     }
 }
Ejemplo n.º 4
0
 public static void InRange(
     double value,
     [NotNull, InvokerParameterName] string argName,
     double fromValue,
     double toValue)
 {
     // DONTTOUCH: handles the NaN values
     if (!(value >= fromValue && value <= toValue))
     {
         throw CodeExceptions.ArgumentOutOfRange(argName, value, fromValue, toValue);
     }
 }