Skip to content

Instantly share code, notes, and snippets.

@snippe
Created January 24, 2015 07:05
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