示例#1
0
 public override Int32 GetHashCode()
 {
     unchecked
     {
         return((WeightInGrams.GetHashCode() * 397) ^ DiameterinMillimeters.GetHashCode());
     }
 }
示例#2
0
        public override int GetHashCode()
        {
            int hash = WeightInGrams.GetHashCode();

            hash = (hash * 31) + AgeInMonths.GetHashCode();
            return(hash);
        }
示例#3
0
        public override int GetHashCode()
        {
            int hash = 17;

            hash = (hash * 23) + Name.GetHashCode();
            hash = (hash * 23) + Type.GetHashCode();
            hash = (hash * 23) + WeightInGrams.GetHashCode();
            return(hash);
        }
示例#4
0
文件: Duck.cs 项目: Rbatts/DuckTask
 public override int GetHashCode()
 {
     unchecked
     {
         int hash = 31;
         hash = hash * 23 + Name.GetHashCode();
         hash = hash * 23 + Type.GetHashCode();
         hash = hash * 23 + WeightInGrams.GetHashCode();
         hash = hash * 23 + AgeInMonths.GetHashCode();
         return(hash);
     }
 }
示例#5
0
 public override string ToString()
 {
     return($"{Name}, Breed {Type}, Months {AgeInMonths}, weight {WeightInGrams.ToString("D", currentCulture )}");
 }
示例#6
0
 public int CompareTo(Duck other)
 {
     return(WeightInGrams.CompareTo(other.WeightInGrams));
 }