C # queues

Source: Internet
Author: User

Give you a small example, if you have a bit of foundation, you should be able to comprehend by analogy.

12345678910111213141516171819202122232425262728 usingSystem.Messaging;// 建一个类publicclassPerson{    publicstringFirstName { getset; }    publicstringLastName { getset; }}//写入消息部分Person p = newPerson(){    FirstName = "Bruce",    LastName = "Lee"};    System.Messaging.Message msg = newSystem.Messaging.Message();    msg.Body = p;    MessageQueue msgQ =newMessageQueue(".\\Private$\\TestQueue");    msgQ.Send(msg);//读出消息部分MessageQueue msgQ = newMessageQueue(".\\Private$\\TestQueue");msgQ.Formatter = newXmlMessageFormatter(newType[] { typeof(Person) });varmessage = (Person)msgQ.Receive().Body;Console.WriteLine("FirstName: "+ message.FirstName + ", LastName: "+ message.LastName);Console.WriteLine("Message received ......");
Ask:
Prompt for missing references, importing which
Chase Answer:
Using System.Messaging;
Quoting this, I'm not writing it.
Ask:
Written, or wrong .... Hint does not exist messaging
Chase Answer:
You add the quote Ah, right click on your project, add the reference (Add Reference ...), and then select the framework under the System.Messaging, and then add to the online tutorial, how to add DLL reference.

C # queues

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.