In This Article

Int32Extensions Class

Provides extension methods for the type Int32.

public static class Int32Extensions
Inheritance:
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 Int32

The value on the left side of the comparison.

right Int32

The value on the left side of the comparison.

difference Int32

The difference threshold.

Returns

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 Int32

The value to constrain.

minValue Int32

The minimum value.

maxValue Int32

The maximum value.

Returns

Int32:

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

Inherited Members