Exemple #1
0
 /// <summary>
 /// Serves as a hash function for a <see cref="T:Narivia.Models.Flag"/> object.
 /// </summary>
 /// <returns>A hash code for this instance that is suitable for use in hashing algorithms and data structures such as a
 /// hash table.</returns>
 public override int GetHashCode()
 {
     unchecked
     {
         return(((Id != null ? Id.GetHashCode() : 0) * 397) ^
                (Layer1 != null ? Layer1.GetHashCode() : 0) ^
                (Emblem != null ? Emblem.GetHashCode() : 0) ^
                (Skin != null ? Skin.GetHashCode() : 0) ^
                Layer1Colour.GetHashCode() ^
                Layer2Colour.GetHashCode() ^
                EmblemColour.GetHashCode());
     }
 }
Exemple #2
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);
        }