示例#1
0
 /// <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);
     }
 }
示例#2
0
        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());
        }
示例#3
0
        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);
        }
示例#4
0
        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());
        }
示例#5
0
        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());
        }
示例#6
0
 public override int GetHashCode()
 {
     return(X1.GetHashCode() + X2.GetHashCode() + X3.GetHashCode() + Y1.GetHashCode() + Y2.GetHashCode() + Y3.GetHashCode());
 }