Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@NikkiBuck
Created November 19, 2012 05:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save NikkiBuck/4109166 to your computer and use it in GitHub Desktop.
Save NikkiBuck/4109166 to your computer and use it in GitHub Desktop.
public int CompareTo(object obj)
{
if (obj is Book)
{
Book otherBook = (Book)obj;
if (this.Title != otherBook.Title)
{
return this.Title.CompareTo(otherBook.Title);
}
}
else
throw new ArgumentException("One or both objects are not books.");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment