Beispiel #1
0
 public void Serialize <T>(Stream stream, T message, SerializerTypeMapper typeMapper)
     where T : class
 {
     using (var outputStream = new NonClosingStream(stream))
         using (var streamWriter = new StreamWriter(outputStream))
             using (XmlWriter writer = XmlWriter.Create(streamWriter, _writerSettings))
             {
                 SerializeMessage(message, writer, new SerializerContext(typeMapper));
             }
 }
Beispiel #2
0
 public SerializerContext(SerializerTypeMapper mapper)
 {
     _mapper = mapper;
 }
Beispiel #3
0
 public SerializerContext()
 {
     _mapper = (d, p, o) => p == typeof(object) ? o.GetType() : p;
 }