/// <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 <uint> > exp, uint val, uint bound1, uint 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(), MathsUInt32Extensions.GetLowerBound(bound1, bound2, allowEitherOrder), MathsUInt32Extensions.GetUpperBound(bound1, bound2, allowEitherOrder) ) ) ); }
public uint GetLowerBound(uint min, uint max, bool allowEitherOrder) { return(MathsUInt32Extensions.GetLowerBound(min, max, allowEitherOrder)); }