コード例 #1
0
ファイル: MXRecord.cs プロジェクト: rajeshwarn/VelodocXp_Src
        /// <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);
            }
        }
コード例 #2
0
ファイル: MXRecord.cs プロジェクト: rajeshwarn/VelodocXp_Src
        /// <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));
            }
        }