Novell.Directory.Ldap.MessageVector.findMessageById C# (CSharp) Method

findMessageById() private method

Finds the Message object with the given MsgID, and returns the Message object. It finds the object and returns it in an atomic operation.
private findMessageById ( int msgId ) : Message
msgId int The msgId of the Message object to return /// ///
return Message
        internal Message findMessageById(int msgId)
        {
            lock (this)
            {
                Message msg = null;
                for (int i = 0; i < Count; i++)
                {
                    //if ((msg = (Message) ToArray()[i]) == null)

                    if ((msg = (Message)(this[i])) == null)
                    {
                        throw new System.FieldAccessException();
                    }
                    if (msg.MessageID == msgId)
                    {
                        return msg;
                    }
                }
                throw new System.FieldAccessException();
            }
        }

Usage Example

コード例 #1
0
 /// <summary> Returns true if any responses are queued for the specified msgId
 ///
 /// return false if no responses are queued, otherwise true
 /// </summary>
 /* package */
 internal bool isResponseReceived(int msgId)
 {
     try
     {
         Message info = messages.findMessageById(msgId);
         return(info.hasReplies());
     }
     catch (System.FieldAccessException ex)
     {
         return(false);
     }
 }