コード例 #1
0
ファイル: ItemStats.cs プロジェクト: NerdDev/Hackmobile
    public int GetHash()
    {
        int hash = 5;

        hash += Weight.GetHashCode() * 3;
        hash += Nutrition.GetHashCode() * 5;
        hash += Cost.GetHashCode() * 11;
        hash += EquipType.GetHashCode() * 17;
        hash += NumberOfSlots.GetHashCode() * 13;
        return(hash);
    }
コード例 #2
0
 /// <summary>
 /// Gets the hash code
 /// </summary>
 /// <returns>Hash code</returns>
 public override int GetHashCode()
 {
     unchecked // Overflow is fine, just wrap
     {
         var hashCode = 41;
         // Suitable nullity checks etc, of course :)
         if (Front != null)
         {
             hashCode = hashCode * 59 + Front.GetHashCode();
         }
         if (Nutrition != null)
         {
             hashCode = hashCode * 59 + Nutrition.GetHashCode();
         }
         if (Ingredients != null)
         {
             hashCode = hashCode * 59 + Ingredients.GetHashCode();
         }
         return(hashCode);
     }
 }