コード例 #1
0
        void IStateSerializer <User> .Write(User value, BinaryWriter writer)
        {
            writer.Write(value.Name);
            writer.Write(value.Age);

            var addressSerializer = new AddressSerializer();

            addressSerializer.Write(value.Address, writer);
        }
コード例 #2
0
        User IStateSerializer <User> .Read(BinaryReader reader)
        {
            var value = new User();

            value.Name = reader.ReadString();
            value.Age  = reader.ReadUInt32();

            var addressSerializer = new AddressSerializer();

            value.Address = addressSerializer.Read(reader);
            return(value);
        }