// Beginn eigner Code /// <summary> /// Vergleicher auf Wertebene /// </summary> /// <param name="y"></param> /// <returns></returns> public int CompareTo(MSRMSR_GerätSignalHW_AnbindungProfibus_PA y) { BinaryFormatter formatter = new BinaryFormatter(); using (MemoryStream memoryStreamX = new MemoryStream()) { using (MemoryStream memoryStreamY = new MemoryStream()) { formatter.Serialize(memoryStreamX, this); formatter.Serialize(memoryStreamY, y); var binaryArrayX = memoryStreamX.GetBuffer(); var binaryArrayY = memoryStreamY.GetBuffer(); if (binaryArrayX.Length != binaryArrayY.Length) { return(binaryArrayX.Length.CompareTo(binaryArrayY.Length)); } for (int i = 0; i < binaryArrayX.Length; i++) { if (binaryArrayX[i] != binaryArrayY[i]) { return(binaryArrayX[i].CompareTo(binaryArrayY[i])); } } } } return(0); }
/// <summary> /// eigener Vergleicher überschrieben Equals /// </summary> /// <param name="other"></param> /// <returns></returns> public bool Equals(MSRMSR_GerätSignalHW_AnbindungProfibus_PA other) { return(this.CompareTo(other) == 0); }