Skip to content

Instantly share code, notes, and snippets.

@snippe
Created January 24, 2015 07:05
Show Gist options
  • Save snippe/eb7ee817a33da2ca8613 to your computer and use it in GitHub Desktop.
Save snippe/eb7ee817a33da2ca8613 to your computer and use it in GitHub Desktop.
public class Person : IComparable
{
public string Name { get; set; }
public int Age { get; set; }
public int CompareTo(Object obj)
{
Person otherPerson = obj as Person;
if (otherPerson == null)
{
throw new ArgumentNullException();
}
else
{
return Age.CompareTo(otherPerson.Age);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment