コード例 #1
0
 public override int GetHashCode()
 {
     unchecked // disable overflow, for the unlikely possibility that you
     {         // are compiling with overflow-checking enabled
         int hash = 27;
         hash = (13 * hash) + Position.GetHashCode();
         hash = (13 * hash) + Velocity.GetHashCode();
         hash = (13 * hash) + Acceleration.GetHashCode();
         hash = (13 * hash) + Lifespan.GetHashCode();
         hash = (13 * hash) + Mass.GetHashCode();
         hash = (13 * hash) + BodySize.GetHashCode();
         hash = (13 * hash) + HistoryLength.GetHashCode();
         hash = (13 * hash) + InitialVelocitySet.GetHashCode();
         hash = (13 * hash) + Orientation.GetHashCode();
         return(hash);
     }
 }
コード例 #2
0
        public bool Equals(ParticleType p)
        {
            // If parameter is null return false:
            if (p == null)
            {
                return(false);
            }

            // Return true if the fields match:
            return(Position.Equals(p.Position) &&
                   Velocity.Equals(p.Velocity) &&
                   Acceleration.Equals(p.Acceleration) &&
                   Lifespan.Equals(p.Lifespan) &&
                   Mass.Equals(p.Mass) &&
                   BodySize.Equals(p.BodySize) &&
                   HistoryLength.Equals(p.HistoryLength) &&
                   InitialVelocitySet.Equals(p.InitialVelocitySet) &&
                   Orientation.Equals(Orientation));
        }