IActorRef IsNobody property is a read-only property that returns a reference to the unique system level “dead letters” ActorRef. This property is a part of the Akka.Actor namespace that provides an actor-based programming model for building concurrent and distributed applications.
Code Examples:
Example 1:
// Creating an actor system using Akka.Actor namespace using Akka.Actor; var actorSystem = ActorSystem.Create("MyActorSystem");
// Creating an actor instance using props object and actor system var myActor = actorSystem.ActorOf(Props.Create(() => new MyActor()));
// Manually sending a message to the dead letters ActorRef var deadLetterActorRef = actorSystem.DeadLetters; deadLetterActorRef.Tell("Hello World!");
// Checking if the dead letter reference is the same as IActorRef nobody var isNobodyRef = Object.ReferenceEquals(deadLetterActorRef, ActorRefs.Nobody); Console.WriteLine($"Is dead letter reference IActorRef nobody? {isNobodyRef}");
Output: Is dead letter reference IActorRef nobody? True
Explanation: In this example, we create an actor system and an instance of a custom actor. Then, we manually send a message to the dead letters ActorRef and check if it is the same as IActorRef nobody using Object.ReferenceEquals.
Example 2:
// Getting the IActorRef nobody reference from the actor system var nobodyRef = actorSystem.DeadLetters; Console.WriteLine($"Is 'nobody' reference equal to dead letters reference? {nobodyRef.Equals(ActorRefs.Nobody)}");
Output: Is 'nobody' reference equal to dead letters reference? True
Explanation: In this example, we retrieve the IActorRef nobody reference from the actor system and compare it with the dead letters reference using the Equals method.
Package Library:
This property is a part of the Akka.Actor namespace, which is provided by the Akka.NET open-source library.
C# (CSharp) IActorRef.IsNobody - 18 examples found. These are the top rated real world C# (CSharp) examples of IActorRef.IsNobody extracted from open source projects. You can rate examples to help us improve the quality of examples.