コード例 #1
0
        /// <summary>
        /// Compares two instances of this object.
        /// </summary>
        /// <param name="Address1">An address.</param>
        /// <param name="Address2">Another address.</param>
        /// <returns>true|false</returns>
        public static Boolean operator <(Address Address1, Address Address2)
        {
            if (Address1 is null)
            {
                throw new ArgumentNullException(nameof(Address1), "The given address must not be null!");
            }

            return(Address1.CompareTo(Address2) < 0);
        }
コード例 #2
0
        /// <summary>
        /// Compares two instances of this object.
        /// </summary>
        /// <param name="Address1">An address.</param>
        /// <param name="Address2">Another address.</param>
        /// <returns>true|false</returns>
        public static Boolean operator >(Address Address1, Address Address2)
        {
            if ((Object)Address1 == null)
            {
                throw new ArgumentNullException(nameof(Address1), "The given Address1 must not be null!");
            }

            return(Address1.CompareTo(Address2) > 0);
        }
コード例 #3
0
        /// <summary>Compares to.</summary>
        /// <param name="other">The other.</param>
        /// <returns>System.Int32.</returns>
        public int CompareTo(PersonFixed other)
        {
            if (other == null)
            {
                return(1);
            }

            int result = 0;

            result = Address1.CompareTo(other.Address1);

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

            result = Address2.CompareTo(other.Address2);

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

            result = BornOn.CompareTo(other.BornOn);
            if (result != 0)
            {
                return(result);
            }

            result = CellPhone.CompareTo(other.CellPhone);

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

            result = City.CompareTo(other.City);
            if (result != 0)
            {
                return(result);
            }

            result = Country.CompareTo(other.Country);

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

            result = Email.CompareTo(other.Email);
            if (result != 0)
            {
                return(result);
            }

            result = FirstName.CompareTo(other.FirstName);

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

            result = HomePhone.CompareTo(other.HomePhone);

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

            result = Id.CompareTo(other.Id);

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

            result = LastName.CompareTo(other.LastName);

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

            result = PostalCode.CompareTo(other.PostalCode);

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

            return(result);
        }