System.Collections.SortedList.Contains C# (CSharp) Method

Contains() public method

public Contains ( Object key ) : bool
key Object
return bool
        public virtual bool Contains(Object key)
        {
            return IndexOfKey(key) >= 0;
        }

Same methods

SortedList::Contains ( object key ) : bool

Usage Example

コード例 #1
0
        /// <summary>
        /// Gets MX records from answer collection and ORDERS them by preference.
        /// NOTE: Duplicate preference records are appended to end. 
        /// </summary>
        /// <returns></returns>
        internal MX_Record[] GetMxRecordsFromAnswers()
        {
            MX_Record[] retVal = null;

            try
            {
                SortedList mx            = new SortedList();
                ArrayList  duplicateList = new ArrayList();
                foreach(Dns_Answer answer in m_Answers){
                    if(answer.QTYPE == QTYPE.MX){
                        MX_Record mxRec = (MX_Record)answer.RecordObj;

                        if(!mx.Contains(mxRec.Preference)){
                            mx.Add(mxRec.Preference,mxRec);
                        }
                        else{
                            duplicateList.Add(mxRec);
                        }
                    }
                }

                MX_Record[] mxBuff = new MX_Record[mx.Count + duplicateList.Count];
                mx.Values.CopyTo(mxBuff,0);
                duplicateList.CopyTo(mxBuff,mx.Count);
                retVal = mxBuff;
            }
            catch{
            }

            return retVal;
        }
All Usage Examples Of System.Collections.SortedList::Contains