/// <summary> /// Remove and return any messages that are stored for the current thread /// and do not match the provided <paramref name="selector"/>. /// </summary> /// <param name="selector">the message selector</param> /// <returns>the removed messages</returns> public override IList <IMessage> Purge(IMessageSelector selector) { IList <IMessage> removedMessages = new List <IMessage>(); IMessage[] allMessages = _queue.ToArray(); foreach (IMessage message in allMessages) { if (!selector.Accept(message) && _queue.Remove(message)) { removedMessages.Add(message); } } return(removedMessages); }