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); }
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); }