Skip to content

Instantly share code, notes, and snippets.

@Larry57
Created January 18, 2013 10:07
Show Gist options
  • Select an option

  • Save Larry57/4563577 to your computer and use it in GitHub Desktop.

Select an option

Save Larry57/4563577 to your computer and use it in GitHub Desktop.
Generic Min Max functions
static T Max<T>(T x, T y)
{
return (Comparer<T>.Default.Compare(x, y) > 0) ? x : y;
}
static T Min<T>(T x, T y)
{
return (Comparer<T>.Default.Compare(x, y) > 0) ? y : x;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment