Ejemplo n.º 1
0
 /// <summary>
 /// Uses a <see cref="BinaryFormatter"/> to write an object of
 /// type <see cref="ActualType"/> to the underlying stream
 /// </summary>
 /// <param name="writer">stream writer</param>
 /// <param name="graph">object to be written to the stream reader</param>
 public override void Write(CompactBinaryWriter writer, object graph)
 {
     if (graph != null)
     {
         Serializer.AlertLegacySerialization(graph.GetType());
     }
     formatter.Serialize(writer.BaseWriter.BaseStream, graph);
 }
Ejemplo n.º 2
0
        /// <summary>
        /// Uses a <see cref="BinaryFormatter"/> to read an object of
        /// type <see cref="ActualType"/> from the underlying stream.
        /// </summary>
        /// <param name="reader">stream reader</param>
        /// <returns>object read from the stream reader</returns>
        public override object Read(CompactBinaryReader reader)
        {
            object result = formatter.Deserialize(reader.BaseStream);

            if (result != null)
            {
                Serializer.AlertLegacySerialization(result.GetType());
            }
            return(result);
        }