IntExt.Clamp Method

Clamps a value so that it doesn’t go beyond a given range.

Namespace: UltimateXR.Extensions.System.Math
Assembly: UltimateXR (in UltimateXR.dll) Version: 0.0.0.0

Syntax

C#

public static int Clamp(
	this ref int self,
	int min,
	int max
)

Parameters

 

self
Type: System.Int32
Value to clamp
min
Type: System.Int32
Minimum value
max
Type: System.Int32
Maximum value

Return Value

Type: Int32
Clamped value between [min, max]

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type . 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

Reference

IntExt Class
UltimateXR.Extensions.System.Math Namespace