Closed oliverbooth closed 3 years ago
Type
System.IComparable<T>
Extension method signature
T Clamp<T>(T, T);
T
Description Returns the current value clamped to the inclusive range of lower and upper.
lower
upper
Benefits Math.Clamp only supports primitives and does not support generic types.
Math.Clamp
Drawbacks None considered (at this time)
(Optional) Implementation example
{ return value.Max(lower).Min(upper); }
Implemented with dd66fb9a2b2476f3d4e4d5c3b504a9ceb76a5cee
Type
Extension method signature
T
T
Description Returns the current value clamped to the inclusive range of
lower
andupper
.Benefits
Math.Clamp
only supports primitives and does not support generic types.Drawbacks None considered (at this time)
(Optional) Implementation example