using System.Diagnostics.Contracts;
namespace System
{
///
/// A with some extension methods for the type
///
public static class IntExtensions
{
///
/// Clamps a number in a specified interval
///
/// The value to clamp
/// The minimum value to return
/// The maximum value to return
[Pure]
public static int Clamp(this int value, int min, int max)
{
if (value < min) return min;
if (value > max) return max;
return value;
}
}
}