Example #1
0
 /// <summary>
 /// Checks whether the value is less as the reference value.
 /// </summary>
 /// <param name="value">The value to test.</param>
 /// <param name="referenceValue">The reference value to test.</param>
 /// <param name="paramName">The name of the parameter that caused the exception.</param>
 /// <param name="message">A message that describes the error.</param>
 /// <exception cref="ArgumentOutOfRangeException"><em>value</em> is out of
 /// range.</exception>
 public static void IsLess(IComparable value, IComparable referenceValue, string paramName, string message)
 {
     if (!value.IsLess(referenceValue))
     {
         throw new ArgumentOutOfRangeException(paramName, referenceValue, message);
     }
 }
        /// <summary>
        /// Indicates whether the instance is less or equal to the reference value.
        /// </summary>
        /// <param name="value">The instance to test.</param>
        /// <param name="referenceValue">The reference value to test.</param>
        /// <returns><strong>true</strong> if the instance is less or equal to the reference
        /// value; otherwise, <strong>false</strong>.</returns>
        /// <exception cref="ArgumentNullException"><em>value</em> or <em>referenceValue</em> is
        /// <strong>null</strong>.</exception>
        public static bool IsLessOrEqual(this IComparable value, IComparable referenceValue)
        {
            Precondition.IsNotNull(value, nameof(value));
            Precondition.IsNotNull(referenceValue, nameof(referenceValue));

            return(value.IsLess(referenceValue) || value.IsEqual(referenceValue));
        }
Example #3
0
 /// <summary>
 /// Checks whether the value is less as the reference value.
 /// </summary>
 /// <param name="value">The value to test.</param>
 /// <param name="referenceValue">The reference value to test.</param>
 /// <exception cref="ArgumentOutOfRangeException"><em>value</em> is out of
 /// range.</exception>
 public static void IsLess(IComparable value, IComparable referenceValue)
 {
     if (!value.IsLess(referenceValue))
     {
         throw new ArgumentOutOfRangeException();
     }
 }