messageenumerator

with MessageEnumerator RemoveCurrent how do I know if I am at end of queue?

余生长醉 提交于 2020-01-24 04:25:28
问题 In MSMQ on .NET, I'm using a MessageEnumerator to look through all the messages in the queue. I want to remove messages that meet a certain condition. When I call MoveNext to step through the queue, I get back a boolean to tell me if the current message exists. But, when I do a RemoveCurrent, how do I know if the current message after the removal exists? Is the only way to check Current and handle the exception? Here is an example where I use the simple condition of removing messages that are