示例#1
0
        public override bool Equals(Object obj)
        {
            if (this == obj)
            {
                return(true);
            }
            if (obj == null)
            {
                return(false);
            }
            if (GetType() != obj.GetType())
            {
                return(false);
            }
            Complex other = (Complex)obj;

            if (field == null)
            {
                if (other.field != null)
                {
                    return(false);
                }
            }
            else if (!field.Equals(other.field))
            {
                return(false);
            }
            if (imag == null)
            {
                if (other.imag != null)
                {
                    return(false);
                }
            }
            else if (!imag.Equals(other.imag))
            {
                return(false);
            }
            if (real == null)
            {
                if (other.real != null)
                {
                    return(false);
                }
            }
            else if (!real.Equals(other.real))
            {
                return(false);
            }
            return(true);
        }