mirror of
https://github.com/nsnail/spectre.console.git
synced 2025-04-30 14:52:51 +08:00
19 lines
307 B
C#
19 lines
307 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;
|
|
}
|
|
} |