HelperFunctions.cs 491 B

1234567891011121314151617181920
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. namespace bbiwarg.Utility
  7. {
  8. public static class HelperFunctions
  9. {
  10. public static T thresholdRange<T>(T min, T max, T value)
  11. {
  12. if (Comparer<T>.Default.Compare(min, value) > 0)
  13. return min;
  14. if (Comparer<T>.Default.Compare(value, max) > 0)
  15. return max;
  16. return value;
  17. }
  18. }
  19. }