1. <strong id="7actg"></strong>
    2. <table id="7actg"></table>

    3. <address id="7actg"></address>
      <address id="7actg"></address>
      1. <object id="7actg"><tt id="7actg"></tt></object>

        Akka.NETAkka? 的 .NET 開(kāi)源實(shí)現(xiàn)

        聯(lián)合創(chuàng)作 · 2023-09-29 13:39

        Akka.NET 是 Akka 的 .NET 開(kāi)源實(shí)現(xiàn)。用于構(gòu)建強(qiáng)大的并發(fā)和分布式應(yīng)用。Akka 是一個(gè)用 Scala 編寫(xiě)的庫(kù),用于簡(jiǎn)化編寫(xiě)容錯(cuò)的、高可伸縮性的 Java 和 Scala 的 Actor 模型應(yīng)用。

        示例代碼:

        using System;
        using System.Collections.Generic;
        using System.Linq;
        using System.Text;
        using System.Threading.Tasks;
        
        using Akka;
        using Akka.Actor;
        
        namespace ConsoleApplication11
        {
            public class Greet
            {
                public Greet(string who)
                {
                    Who = who;
                }
                public string Who { get;private set; }
            }
        
            public class GreetingActor : ReceiveActor
            {
                public GreetingActor()
                {
                    Receive<Greet>(greet => 
                       Console.WriteLine("Hello {0}", greet.Who));
                }
            }
        
            class Program
            {
                static void Main(string[] args)
                {
                    //create a new actor system (a container for your actors)
                    var system = ActorSystem.Create("MySystem");
                    //create your actor and get a reference to it.
                    //this will be an "ActorRef", which is not a 
                    //reference to the actual actor instance
                    //but rather a client or proxy to it
                    var greeter = system.ActorOf<GreetingActor>("greeter");
                    //send a message to the actor
                    greeter.Tell(new Greet("World"));
        
                    //this prevents the app from exiting
                    //Before the async work is done
                    Console.ReadLine();
                }
            }
        }
        瀏覽 22
        點(diǎn)贊
        評(píng)論
        收藏
        分享

        手機(jī)掃一掃分享

        編輯 分享
        舉報(bào)
        評(píng)論
        圖片
        表情
        推薦
        點(diǎn)贊
        評(píng)論
        收藏
        分享

        手機(jī)掃一掃分享

        編輯 分享
        舉報(bào)
        1. <strong id="7actg"></strong>
        2. <table id="7actg"></table>

        3. <address id="7actg"></address>
          <address id="7actg"></address>
          1. <object id="7actg"><tt id="7actg"></tt></object>
            视频一二三四区 | 色色色热热热 | 影音先锋在线资源网站 | 我看亚洲逼| 囯产精品宾馆在线精品酒店 | 免费一级大毛片免费收看 | 国产21在线 | 国产区第二页 | 操人www. | 特级爱爱视频 |