Exemplo n.º 1
0
        /// <summary>
        /// Gets MX records.(MX records are sorted by preference, lower array element is prefered)
        /// </summary>
        /// <returns></returns>
        public MX_Record[] GetMXRecords()
        {
            MX_Record[] mxRecords     = (MX_Record[])FilterRecords(m_pAnswers, typeof(MX_Record)).ToArray(typeof(MX_Record));
            SortedList  mx            = new SortedList();
            ArrayList   duplicateList = new ArrayList();

            foreach (MX_Record mxRecord in mxRecords)
            {
                if (!mx.Contains(mxRecord.Preference))
                {
                    mx.Add(mxRecord.Preference, mxRecord);
                }
                else
                {
                    duplicateList.Add(mxRecord);
                }
            }

            mxRecords = new MX_Record[mx.Count + duplicateList.Count];
            mx.Values.CopyTo(mxRecords, 0);
            duplicateList.CopyTo(mxRecords, mx.Count);

            return(mxRecords);
        }
		/// <summary>
		/// Gets MX records.(MX records are sorted by preference, lower array element is prefered)
		/// </summary>
		/// <returns></returns>
		public MX_Record[] GetMXRecords()
		{
			MX_Record[] mxRecords = (MX_Record[])FilterRecords(m_pAnswers,typeof(MX_Record)).ToArray(typeof(MX_Record));
			SortedList mx            = new SortedList();
			ArrayList  duplicateList = new ArrayList();
			foreach(MX_Record mxRecord in mxRecords){
				if(!mx.Contains(mxRecord.Preference)){
					mx.Add(mxRecord.Preference,mxRecord);
				}
				else{
					duplicateList.Add(mxRecord);
				}
			}

			mxRecords = new MX_Record[mx.Count + duplicateList.Count];
			mx.Values.CopyTo(mxRecords,0);
			duplicateList.CopyTo(mxRecords,mx.Count);

			return mxRecords;
		}