コード例 #1
0
        public bool Equals(SimpleTime time)
        {
            // Check for null.
            if (time == null)
            {
                return(false);
            }

            // Check for ReferenceEquals if this is a reference type.
            if (ReferenceEquals(this, time))
            {
                return(true);
            }

            // Possibly check for equivalent hash codes.
            if (this.GetHashCode() != time.GetHashCode())
            {
                return(false);
            }

            // Check base.Equals if base overrides Equals().
            System.Diagnostics.Debug.Assert(base.GetType() != typeof(object));

            if (!base.Equals(time))
            {
                return(false);
            }

            // Compare identifying fields for equality.
            return(this.hour.Equals(time.hour) && this.minute.Equals(time.minute) && this.second.Equals(time.second));
        }