Skip to content

Instantly share code, notes, and snippets.

@stefansedich
Last active August 29, 2015 14:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stefansedich/0c5e1d2ac431eccd9fed to your computer and use it in GitHub Desktop.
Save stefansedich/0c5e1d2ac431eccd9fed to your computer and use it in GitHub Desktop.
public class ParentActor : ReceiveActor {
private ActorRef _child;
public ParentActor() {
_child = Context.ActorOf<Child>();
Receive<Start>(m => {
_child.Tell(new Child.Start{State = 123}));
});
}
public class Start {
}
}
public class ChildActor : ReceiveActor {
private Something _someState;
public ChildActor() {
Receive<Start>(m => {
_someState = new Something(m.State);
Self.Tell(new DoStuff());
});
Receive<DoStuff>(m => {
_someState.Read(); // This could fail
Self.Tell(new DoStuff());
});
}
public class Start {
public int State { get;set; }
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment