static private void Serialize(object input, ISerializationContext context, Type expected) { byte[] array = NetDataContractSerializerHelper.Serialize(input); context.StreamWriter.Write(array.Length); context.StreamWriter.Write(array); }
static private object Deserialize(Type expected, IDeserializationContext context) { var len = context.StreamReader.ReadInt(); return(NetDataContractSerializerHelper.Deserialize(context.StreamReader.ReadBytes(len))); }