public int CompareTo(DeviceInfo other) { if (ReferenceEquals(this, other)) { return(0); } if (ReferenceEquals(null, other)) { return(1); } var idComparison = string.Compare(ID, other.ID, StringComparison.Ordinal); if (idComparison != 0) { return(idComparison); } return(DeviceType.CompareTo(other.DeviceType)); }