/// <summary>
        /// Ensures the expression and corresponding value evaluates to between the specified values
        /// </summary>
        /// <param name="exp">The exp.</param>
        /// <param name="val">The value.</param>
        /// <param name="bound1">The bound1.</param>
        /// <param name="bound2">The bound2.</param>
        /// <param name="allowEitherOrder">if set to <c>true</c> [allow either order].</param>
        /// <param name="boundsType">Type of the bounds.</param>
        /// <exception cref="ArgumentOutOfRangeException"></exception>
        /// <exception cref="System.ArgumentOutOfRangeException"></exception>
        public static void IsBetween(Expression <Func <byte> > exp, byte val, byte bound1, byte bound2, bool allowEitherOrder, IsBetweenBoundsType boundsType)
        {
            if (val.IsBetween(bound1, bound2, allowEitherOrder, boundsType))
            {
                return;
            }

            var memberName = ExpressionExtensions.GetMemberName(exp);

            throw new ArgumentOutOfRangeException(
                      memberName,
                      val,
                      string.Format("{0} must be {1}",
                                    memberName,
                                    string.Format(boundsType.GetLimitDescriptionFormat(),
                                                  MathsByteExtensions.GetLowerBound(bound1, bound2, allowEitherOrder),
                                                  MathsByteExtensions.GetUpperBound(bound1, bound2, allowEitherOrder)
                                                  )
                                    )
                      );
        }
 public byte GetUpperBound(byte min, byte max, bool allowEitherOrder)
 {
     return(MathsByteExtensions.GetUpperBound(min, max, allowEitherOrder));
 }