/// <summary> /// Extension method that allows for <see cref="IntegralRangeBase{TIntegralType}.Constrain"/> /// to be called on a <see cref="Int32"/> subject with the range and exclusivity passed as a /// parameter, rather than on the <see cref="IntegralRangeBase{TIntegralType}"/> object /// with a <see cref="Int32"/> parameter. /// </summary> /// <param name="this"> /// The subject <see cref="Int32"/> value in which to check against the <paramref name="range"/> /// parameter to constrain a value within a range with an implicit inclusive comparison mode. /// </param> /// <param name="range"> /// An instance of the type <see cref="Int32Range"/>, describing a range of numeric values in /// which the <paramref name="this"/> subject is to be compared against. /// </param> /// <exception cref="ArgumentNullException"> /// Thrown when the specified <paramref name="range"/> is <see langword="null"/>. /// </exception> /// <returns> /// A <see cref="Int32"/> value that is the <paramref name="this"/> subject value adjusted to /// force the range of possible values to be within the provided <paramref cref="range"/> /// parameter, using <see cref="EndpointExclusivity.Inclusive"/> as the comparison mode. /// </returns> public static Int32 Constrain( this Int32 @this, [NotNull] Int32Range range) { range.IsNotNull(nameof(range)); return(range .Constrain( @this)); }