Skip to content

Instantly share code, notes, and snippets.

@wezmag
Created April 14, 2017 07:38
Show Gist options
  • Save wezmag/ff7e3dc50c16b2879fd60ee8441b2205 to your computer and use it in GitHub Desktop.
Save wezmag/ff7e3dc50c16b2879fd60ee8441b2205 to your computer and use it in GitHub Desktop.
Some extensions
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