Closed oliverbooth closed 3 years ago
Type
System.IComparable<T>
Extension method signature
T Max<T>(T); T Min<T>(T);
T
Description Returns the maximum/minimum of two values.
Benefits Math.Min() and Math.Max only support primitives and do not support generic comparable types.
Math.Min()
Math.Max
Drawbacks None considered (at this time)
(Optional) Implementation example
{ return value.GreaterThan(other) ? value : other; // or return value.LessThan(other) ? value : other; }
Implemented with ac8aead71dff9f14e5dac694e4896fff01f2e714
Type
Extension method signature
T
Description Returns the maximum/minimum of two values.
Benefits
Math.Min()
andMath.Max
only support primitives and do not support generic comparable types.Drawbacks None considered (at this time)
(Optional) Implementation example