Ejemplo n.º 1
0
        // If Equals() returns true for a pair of objects
        // then GetHashCode() must return the same value for these objects.

        public override int GetHashCode()
        {
            //Get hash code for the Name field if it is not null.
            int hashIzolName = Type == null ? 0 : Type.GetHashCode();

            //Get hash code for the Code field.
            int hashTube   = Tube.GetHashCode();
            int hashLayer1 = Layer1.GetHashCode();
            int hashLayer2 = Layer2.GetHashCode();
            int hashLayer3 = Layer3.GetHashCode();

            //Calculate the hash code for the product.
            //return hashProductName ^ hashProductCode;
            return(hashIzolName ^ hashTube ^ hashLayer1 ^ hashLayer2 ^ hashLayer3);
        }