Comparison public static class Comparison Provides generic methods to work with comparable values. Documentation Code public static T Clamp<T>(this T value, T min, T max) where T : IComparable<T> Restricts a value in specific range. public static bool IsBetween<T>(this T value, T left, T right, BoundType boundType = 0) where T : IComparable<T> Checks whether specified value is in range.