Beispiel #1
0
        public int CompareTo(ComplexNumber other)
        {
            if (ReferenceEquals(this, other))
            {
                return(0);
            }
            if (ReferenceEquals(null, other))
            {
                return(1);
            }
            var realRartComparison = RealPart.CompareTo(other.RealPart);

            return(realRartComparison != 0 ? realRartComparison : ImagPart.CompareTo(other.ImagPart));
        }
Beispiel #2
0
        public int CompareTo(Complex other)
        {
            if (ReferenceEquals(this, other))
            {
                return(0);
            }

            if (ReferenceEquals(null, other))
            {
                return(1);
            }

            var realPartComparison = RealPart.CompareTo(other.RealPart);

            if (realPartComparison != 0)
            {
                return(realPartComparison);
            }

            return(VirtualPart.CompareTo(other.VirtualPart));
        }