/// <summary> /// Gets the hash code /// </summary> /// <returns>Hash code</returns> public override int GetHashCode() { unchecked // Overflow is fine, just wrap { int hashCode = 41; hashCode = hashCode * 59 + Type.GetHashCode(); hashCode = hashCode * 59 + Barcode1DSymbology.GetHashCode(); if (Data != null) { hashCode = hashCode * 59 + Data.GetHashCode(); } hashCode = hashCode * 59 + X1.GetHashCode(); hashCode = hashCode * 59 + X2.GetHashCode(); hashCode = hashCode * 59 + X3.GetHashCode(); hashCode = hashCode * 59 + X4.GetHashCode(); hashCode = hashCode * 59 + Y1.GetHashCode(); hashCode = hashCode * 59 + Y2.GetHashCode(); hashCode = hashCode * 59 + Y3.GetHashCode(); hashCode = hashCode * 59 + Y4.GetHashCode(); hashCode = hashCode * 59 + BboxLeftInches.GetHashCode(); hashCode = hashCode * 59 + BboxTopInches.GetHashCode(); hashCode = hashCode * 59 + BboxWidthInches.GetHashCode(); hashCode = hashCode * 59 + BboxHeightInches.GetHashCode(); hashCode = hashCode * 59 + PageNumber.GetHashCode(); hashCode = hashCode * 59 + PagePixelWidth.GetHashCode(); hashCode = hashCode * 59 + PagePixelHeight.GetHashCode(); hashCode = hashCode * 59 + PageHorizontalResolution.GetHashCode(); hashCode = hashCode * 59 + PageVerticalResolution.GetHashCode(); return(hashCode); } }
public override int GetHashCode() { int prime = 37; int hash = 1; hash = prime * hash + X1.GetHashCode(); hash = prime * hash + X2.GetHashCode(); hash = prime * hash + X3.GetHashCode(); hash = prime * hash + Y1.GetHashCode(); hash = prime * hash + Y2.GetHashCode(); return(prime * hash + Y3.GetHashCode()); }
public override int GetHashCode() { var prime = 37; var hash = 1; hash = prime * hash + X1.GetHashCode(); hash = prime * hash + Y1.GetHashCode(); hash = prime * hash + X2.GetHashCode(); hash = prime * hash + Y2.GetHashCode(); hash = prime * hash + X3.GetHashCode(); hash = prime * hash + Y3.GetHashCode(); return(hash); }
public static void SameObjectsHaveSameHashes() { var x = new X3 { F1 = "some string", F2 = 17, F3 = new X1() }; var y = new X3 { F1 = "some string", F2 = 17, F3 = new X1() }; Assert.Equal(x.GetHashCode(), y.GetHashCode()); }
public static void DifferentObjectsHaveDifferentHashes() { var x = new X3 { F1 = "some string", F2 = 17, F3 = new X1() }; var y = new X3 { F1 = "some string xxx", F2 = 17, F3 = new X1() }; Assert.NotEqual(x.GetHashCode(), y.GetHashCode()); }
public override int GetHashCode() { return(X1.GetHashCode() + X2.GetHashCode() + X3.GetHashCode() + Y1.GetHashCode() + Y2.GetHashCode() + Y3.GetHashCode()); }