Exemplo n.º 1
0
 public void Serialize(BinaryWriter writer)
 {
     writer.Write(_blocks.Count());
     foreach (var block in _blocks)
     {
         var blockPayload = new SingleStateBlockPayload(block);
         blockPayload.Serialize(writer);
     }
 }
Exemplo n.º 2
0
        // Using the SingleStateBlockPayload
        public void Deserialize(BinaryReader reader)
        {
            var deserializedBlocks = new List <Block>();
            var count = reader.ReadInt32();

            for (int i = 0; i < count; i++)
            {
                var blockPayload = new SingleStateBlockPayload();
                blockPayload.Deserialize(reader);
                deserializedBlocks.Add(blockPayload.Block);
            }
            _blocks = deserializedBlocks;
        }