public int CompareTo(object obj) { FileName other; try { other = (FileName)obj; } catch (InvalidCastException) { throw new ArgumentException("obj is not a FileName"); } if (this < other) { return -1; } if (this > other) { return 1; } return 0; }