Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //3.
- public int CompareTo(Student other)
- {
- if (this.FirstName.CompareTo(other.FirstName) != 0)
- {
- return this.FirstName.CompareTo(other.FirstName);
- }
- if (this.MiddleName.CompareTo(other.MiddleName) != 0)
- {
- return this.MiddleName.CompareTo(other.MiddleName);
- }
- if (this.LastName.CompareTo(other.LastName) != 0)
- {
- return this.LastName.CompareTo(other.LastName);
- }
- if (this.Ssn.CompareTo(other.Ssn) != 0)
- {
- return this.Ssn.CompareTo(other.Ssn);
- }
- return 0;
- }
- public int CompareTo(Object obj)
- {
- if (obj != null && !(obj is Student))
- {
- throw new ArgumentException("Object must be of type Student.");
- }
- return CompareTo(obj as Student);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement