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)); } }
public SerializerContext(SerializerTypeMapper mapper) { _mapper = mapper; }
public SerializerContext() { _mapper = (d, p, o) => p == typeof(object) ? o.GetType() : p; }