Ejemplo n.º 1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="obj"></param>
        /// <returns></returns>
        public override bool Equals(object value)
        {
            MXRecord objMXRecord = value as MXRecord;

            if (objMXRecord == null)
            {
                return(false);
            }
            else if (objMXRecord._Preference != _Preference) // preference must match
            {
                return(false);
            }
            else if (objMXRecord._DomainName != _DomainName) // and so must the domain name
            {
                return(false);
            }
            else // its a match
            {
                return(true);
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Implements the IComparable interface so that we can sort the MX records by their
        /// lowest preference
        /// </summary>
        /// <param name="other">the other MxRecord to compare against</param>
        /// <returns>1, 0, -1</returns>
        public int CompareTo(object value)
        {
            MXRecord objMXRecord = value as MXRecord;

            if (objMXRecord == null)
            {
                return(1);
            }
            // we want to be able to sort MX Records by preference
            else if (objMXRecord._Preference < _Preference)
            {
                return(1);
            }
            else if (objMXRecord._Preference > _Preference)
            {
                return(-1);
            }
            else             // order mail servers of same preference by name
            {
                return(-objMXRecord._DomainName.CompareTo(_DomainName));
            }
        }