MessageQueue消息队列的使用
//Send
MessageQueue MQueue = new MessageQueue(".\\private$\\MQDemo");
System.Messaging.Message Msg = new System.Messaging.Message();
Msg.Body = textBox1.Text;
Msg.Formatter = new System.Messaging.XmlMessageFormatter(new Type[] { typeof(string) });
MQueue .Send(Msg);
//Receive
MessageQueue MQueue = new MessageQueue(".\\private$\\MQDemo");
System.Messaging.Message Msg = MQueue.Receive();
Msg.Formatter = new System.Messaging.XmlMessageFormatter(new Type[] { typeof(string) });
MessageBox.Show(Msg.Body.ToString());