Skip to content

Instantly share code, notes, and snippets.

@NikkiBuck
Created November 19, 2012 05:57

Revisions

  1. NikkiBuck created this gist Nov 19, 2012.
    13 changes: 13 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,13 @@
    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.");
    }