这是我的一段循环读取消息队列的代码:
MessageQueue Mq = new MessageQueue(@".\private$\SGIP_MT");
while(true)
{
string[] types = { "System.String" };
((XmlMessageFormatter)Mq.Formatter).TargetTypeNames = types;
Message m=Mq.Receive();
Console.WriteLine((string)m.Body);
}我想判断消息队列如果没有消息了,就它程序Sleep(1000)一下.请高手指教!
MessageQueue Mq = new MessageQueue(@".\private$\SGIP_MT");
while(true)
{
string[] types = { "System.String" };
((XmlMessageFormatter)Mq.Formatter).TargetTypeNames = types;
Message m=Mq.Receive();
Console.WriteLine((string)m.Body);
}我想判断消息队列如果没有消息了,就它程序Sleep(1000)一下.请高手指教!
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货