Esempio n. 1
0
        // for custom type, must override the equals method, so as to know whether a value changed
        public override bool Equals(Object obj)
        {
            if (object.ReferenceEquals(this, obj))
            {
                return(true);
            }
            if (obj == null)
            {
                return(false);
            }
            if (GetType() != obj.GetType())
            {
                return(false);
            }
            MyCustomType other = (MyCustomType)obj;

            if (Name == null)
            {
                if (other.Name != null)
                {
                    return(false);
                }
            }
            else if (!Name.Equals(other.Name))
            {
                return(false);
            }
            if (Say == null)
            {
                if (other.Say != null)
                {
                    return(false);
                }
            }
            else if (!Say.Equals(other.Say))
            {
                return(false);
            }
            if (Times != other.Times)
            {
                return(false);
            }
            return(true);
        }