Ejemplo n.º 1
0
        private static void Main(string[] args)
        {
            s_typeModel = TypeModel.Create();
            s_typeAliasTable = new TypeAliasTable();

            // Serialize
            var writeStream = new MemoryStream();
            var obj1 = new AliceClass { Name = "Wonderland", Value = 100 };
            Console.WriteLine("Before Serialize: {0}", obj1);
            Serialize(writeStream, obj1);
            var data = writeStream.ToArray();
            Console.WriteLine("DataSize: {0}", data.Length);

            // Deserialize
            var readStream = new MemoryStream(data);
            var obj2 = Deserialize(readStream, (int)readStream.Length);
            Console.WriteLine("After Serialize: {0}", obj2);
        }
Ejemplo n.º 2
0
 public ProtobufSerializer(ExtendedActorSystem system)
     : base(system)
 {
     _typeModel = CreateTypeModel();
     _typeTable = new TypeAliasTable();
 }
 public Data(IMessageSerializer serializer, TypeAliasTable typeTable)
 {
     MessageSerializer = serializer;
     TypeTable = typeTable;
 }