public int CompareTo(object obj) { PersonOnBoard p = obj as PersonOnBoard; if (p != null) { return(Name.CompareTo(p.Name)); } else { throw new Exception("It's impossible to compare two objects"); } }