public int CompareTo(Error other) { if (ReferenceEquals(this, other)) { return(0); } if (ReferenceEquals(null, other)) { return(1); } var statusCodeComparison = StatusCode.CompareTo(other.StatusCode); if (statusCodeComparison != 0) { return(statusCodeComparison); } var messageComparison = string.Compare(Message, other.Message, StringComparison.Ordinal); return(messageComparison != 0 ? messageComparison : EventId.CompareTo(other.EventId)); }