static void Serialize(ref SerializationContext context, ref SpecialType input) { if (!context.Key.Equals(input.Key)) throw new InvalidDataException(); var bw = new BinaryWriter(context.Stream); bw.Write(input.Value); bw.Flush(); }
static void Deserialize(ref DeserializationContext context, out SpecialType output) { var br = new BinaryReader(context.Stream); output = new SpecialType(context.Key, br.ReadUInt32()); }