All c# extension methods for icomparable-t

  • Limit<>

    Limits a value to a maximum. For example this is usefull if you want to feed a progressBar with values from a source which eventually might exceed an expected maximum. This is a generic extension method with IComparable<T> constraint. So every type which implements the IComparable interface benefits from this extension.
    C# System.IComparable<T> Rainer Hilmer
  • LessThan

    Returns a boolean value of true if the item being compared is less than the value of the parameter.
    C# System.IComparable<T> Richard Bushnell
  • Between

    Works on Comparables to check whether the checked value is between two other values. Check -> extension methods for more details.
    C# System.IComparable<T> Frank Quednau
  • ConstrainToRange

    Many times you may wish to impose boundaries on what a certain variable can be. This is especially useful for validating user input. For any comparable, it simply returns the value, truncated by a minimum or maximum
    C# System.IComparable<T> David Harris