In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly explains "how to use the Tag Message of C#". Interested friends may wish to have a look. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn how to use Tag Message in C#.
Generally speaking, the Erlang message is a tuple, while the * * elements of the tuple are atoms that identify "what to do". This atom is called the message tag, and this usage is called Tag Message, which is recommended in the Erlang programming specification. In C#, of course, we can also do this:
Tag Message of C #
Class Person: Actor {protected override void Receive (Message message) {if (message.Tag = = "Chat") {Person another = (Person) message.Arguments [0]; Topic topic = (Topic) message.Arguments [1] / /...} else if (message.Tag = = "Eat") {Restaurant restaurant = (Restaurant) message.Arguments [0]; / /...} else if (message.Tag = = "Work") {Person reportTo = (Person) message.Arguments [0] Job job = (Job) message.Arguments [1]; / /...}
The Tag Message diagram of C# is as follows:
Tag Message of C # is the same as Erlang, but due to the lack of pattern matching and automatic binding of Erlang, C # code requires a lot of if. Else judgment, as well as tedious and dangerous transformation operations. In addition, the disadvantages of dynamic types are exactly the same as those of dynamic types in Erlang, both sending and receiving messages are not static types at all, so static checking, editing, or refactoring are difficult. Imagine that if the message structure accepted by a common service changes, all uses of it must be modified correctly-in the absence of static checks, errors can only be found at run time. Erlang has a strong dynamic upgrade capability and can accept continuous online updates. In the .NET platform, if you use this Tag Message approach, it will be more troublesome to fix it when errors are found at run time.
At this point, I believe you have a deeper understanding of "how to use Tag Message in C#". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.