LumiSoft.Net.Dns.Client.DnsServerResponse.GetMXRecords C# (CSharp) Method

GetMXRecords() public method

Gets MX records.(MX records are sorted by preference, lower array element is prefered)
public GetMXRecords ( ) : LumiSoft.Net.Dns.Client.MX_Record[]
return LumiSoft.Net.Dns.Client.MX_Record[]
        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;
        }