mirror of
https://github.com/spectreconsole/spectre.console.git
synced 2025-12-28 16:58:05 +01:00
21 lines
370 B
C#
21 lines
370 B
C#
namespace Spectre.Console
|
|
{
|
|
internal static class Int32Extensions
|
|
{
|
|
public static int Clamp(this int value, int min, int max)
|
|
{
|
|
if (value <= min)
|
|
{
|
|
return min;
|
|
}
|
|
|
|
if (value >= max)
|
|
{
|
|
return max;
|
|
}
|
|
|
|
return value;
|
|
}
|
|
}
|
|
}
|