Created
February 15, 2021 19:50
-
-
Save jessemlay/ae824dd78d7bd1d162c2d8062afa3d06 to your computer and use it in GitHub Desktop.
useful extension methods
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static class MyExtensions | |
{ | |
public static bool IsBetween<T>(this T value, T min, T max) where T : IComparable | |
{ | |
return (min.CompareTo(value) <= 0) && (value.CompareTo(max) <= 0); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment