Click or drag to resize

MathExtensionsClip Method (Int32, Int32, Int32)

Clips the specified value so it does not exceed min or max.

Namespace:  TomsToolbox.Essentials
Assembly:  TomsToolbox.Essentials (in TomsToolbox.Essentials.dll)
Syntax
public static int Clip(
	this int value,
	int minValue,
	int maxValue
)

Parameters

value
Type: SystemInt32
The value.
minValue
Type: SystemInt32
The minimum value.
maxValue
Type: SystemInt32
The maximum value.

Return Value

Type: Int32
The clipped value.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type Int32. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).
See Also