Akka.Remote.Serialization.DaemonMsgCreateSerializer.ToBinary C# (CSharp) Method

ToBinary() public method

Serializes the given object into a byte array
Can't serialize a non- message using
public ToBinary ( object obj ) : byte[]
obj object The object to serialize
return byte[]
        public override byte[] ToBinary(object obj)
        {
            var msg = obj as DaemonMsgCreate;
            if (msg == null)
            {
                throw new ArgumentException(
                    "Can't serialize a non-DaemonMsgCreate message using DaemonMsgCreateSerializer");
            }
       
            DaemonMsgCreateData daemonBuilder = DaemonMsgCreateData.CreateBuilder()
                .SetProps(GetPropsData(msg.Props))
                .SetDeploy(GetDeployData(msg.Deploy))
                .SetPath(msg.Path)
                .SetSupervisor(SerializeActorRef(msg.Supervisor))
                .Build();

            return daemonBuilder.ToByteArray();
        }