Created
April 14, 2017 07:38
-
-
Save wezmag/ff7e3dc50c16b2879fd60ee8441b2205 to your computer and use it in GitHub Desktop.
Some extensions
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 GenericExtension | |
{ | |
public static bool Between<T>(this T value, T from, T to) where T : IComparable | |
{ | |
return value.CompareTo(from) >= 0 && value.CompareTo(to) <= 0; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment