/// <summary> /// Compares two ExecMsgs for display sorting purposes. /// Messages with higher severity are first, then messages /// with lower MessageID's. Finally, if multiple messages /// with the same ID are in the list, they are compared /// by the Message text, so they always appear in the same /// canonical order. /// </summary> public int CompareTo(object obj) { if ((obj == null) || !(obj is ExecMsg)) { return(-1); } ExecMsg msg = (ExecMsg)obj; int C = -Severity.CompareTo(msg.Severity); if (C != 0) { return(C); } C = MessageID.CompareTo(msg.MessageID); if (C != 0) { return(C); } return(Message.CompareTo(msg.Message)); }