In This Article

Int32Extensions Class

Provides extension methods for the type System.Int32.

public static class Int32Extensions
Inheritance:
System.Object Object

Methods

IsWithin(Int32, Int32, Int32)

Determines whether the two values are within a specified range.

public static bool IsWithin(this int left, int right, int difference)
Parameter Type Description
left System.Int32

The value on the left side of the comparison.

right System.Int32

The value on the left side of the comparison.

difference System.Int32

The difference threshold.

Returns

System.Boolean:

true if the two values within a specified range; otherwise, false.

Range(Int32, Int32, Int32)

Returns the specified value constrained to the specified minimum and maximum values.

public static int Range(this int value, int minValue, int maxValue)
Parameter Type Description
value System.Int32

The value to constrain.

minValue System.Int32

The minimum value.

maxValue System.Int32

The maximum value.

Returns

System.Int32:

The specified value constrained to the specified minimum and maximum values.

Inherited Members

  • System.Object.ToString()
  • System.Object.Equals(System.Object)
  • System.Object.Equals(System.Object, System.Object)
  • System.Object.ReferenceEquals(System.Object, System.Object)
  • System.Object.GetHashCode()
  • System.Object.GetType()
  • System.Object.MemberwiseClone()