// -------------------------------------------------------------------------------------------------------------------- // // Copyright © James South and contributors. // Licensed under the Apache License, Version 2.0. // // // Extension methods for classes that implement . // // -------------------------------------------------------------------------------------------------------------------- namespace ImageProcessor { using System; /// /// Extension methods for classes that implement . /// internal static class ComparableExtensions { /// /// Returns value indicating whether the given number is with in the minimum and maximum /// given range. /// /// The value to to check. /// The minimum range value. /// The maximum range value. /// The to test. /// /// True if the value falls within the maximum and minimum; otherwise, false. /// public static bool IsBetween(this T value, T min, T max) where T : IComparable { return (value.CompareTo(min) > 0) && (value.CompareTo(max) < 0); } } }