예제 #1
0
        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();
        }
예제 #2
0
 static void Deserialize(ref DeserializationContext context, out SpecialType output)
 {
     var br = new BinaryReader(context.Stream);
     output = new SpecialType(context.Key, br.ReadUInt32());
 }