public int CompareTo(Message message) { return(-CreatedAt.CompareTo(message.CreatedAt)); }
public int CompareTo(Credential other) { Int32 idCompare = ID.CompareTo(other.ID); if (idCompare != 0) { return(idCompare); } Int32 glyphKeyCompare = GlyphKey.CompareTo(other.GlyphKey); if (glyphKeyCompare != 0) { return(glyphKeyCompare); } Int32 glyphColourCompare = GlyphColour.CompareTo(other.GlyphColour); if (glyphColourCompare != 0) { return(glyphColourCompare); } Int32 nameCompare = Name.CompareTo(other.Name); if (nameCompare != 0) { return(nameCompare); } Int32 descriptionCompare = Description.CompareTo(other.Description); if (descriptionCompare != 0) { return(descriptionCompare); } Int32 websiteCompare = Website.CompareTo(other.Website); if (websiteCompare != 0) { return(websiteCompare); } Int32 createdAtCompare = CreatedAt.CompareTo(other.CreatedAt); if (createdAtCompare != 0) { return(createdAtCompare); } Int32 lastUpdatedAtCompare = LastModifiedAt.CompareTo(other.LastModifiedAt); if (lastUpdatedAtCompare != 0) { return(lastUpdatedAtCompare); } Int32 usernameCompare = Username.CompareTo(other.Username); if (usernameCompare != 0) { return(usernameCompare); } Int32 passwordCompare = Password.CompareTo(other.Password); if (passwordCompare != 0) { return(passwordCompare); } if (Tags.Count == other.Tags.Count) { if (!Tags.OrderBy(i => i).SequenceEqual(other.Tags.OrderBy(i => i))) { return(-1); } } else { return(-1); } Int32 notesCompare = Notes.CompareTo(other.Notes); if (notesCompare != 0) { return(notesCompare); } return(0); }
public int CompareTo(Vault other) { Int32 idCompare = ID.CompareTo(other.ID); if (idCompare != 0) { return(idCompare); } Int32 nameCompare = Name.CompareTo(other.Name); if (nameCompare != 0) { return(nameCompare); } Int32 descriptionCompare = Description.CompareTo(other.Description); if (descriptionCompare != 0) { return(descriptionCompare); } Int32 createdAtCompare = CreatedAt.CompareTo(other.CreatedAt); if (createdAtCompare != 0) { return(createdAtCompare); } Int32 lastUpdatedAtCompare = LastUpdatedAt.CompareTo(other.LastUpdatedAt); if (lastUpdatedAtCompare != 0) { return(lastUpdatedAtCompare); } if (Credentials.Count == other.Credentials.Count) { Credential[] a = Credentials.OrderBy(i => i).ToArray(); Credential[] b = other.Credentials.OrderBy(i => i).ToArray(); for (Int32 iCred = 0; iCred < a.Length; iCred++) { Credential credA = a[iCred]; Credential credB = b[iCred]; Int32 compValue = credA.CompareTo(credB); if (compValue != 0) { return(compValue); } } } else { return(Credentials.Count.CompareTo(other.Credentials.Count)); } if (AuditLogEntries.Count == other.AuditLogEntries.Count) { AuditLogEntry[] a = AuditLogEntries.OrderBy(i => i.DateTime).ToArray(); AuditLogEntry[] b = other.AuditLogEntries.OrderBy(i => i.DateTime).ToArray(); for (Int32 iEntry = 0; iEntry < a.Length; iEntry++) { AuditLogEntry entryA = a[iEntry]; AuditLogEntry entryB = b[iEntry]; Int32 compValue = entryA.CompareTo(entryB); if (compValue != 0) { return(compValue); } } } else { return(AuditLogEntries.Count.CompareTo(other.AuditLogEntries.Count)); } return(0); }