示例#1
0
        public string Get(object parameter)
        {
            var stream = _stream();

            using (var writer = _factory.Get(stream))
            {
                _serializer.Serialize(writer, parameter);
                writer.Flush();
                stream.Seek(0, SeekOrigin.Begin);
                var result = new StreamReader(stream).ReadToEnd();
                return(result);
            }
        }
示例#2
0
 static void Serialize(this IExtendedXmlSerializer @this, IXmlWriterFactory factory, TextWriter writer,
                       object instance)
 => @this.Serialize(factory.Get(writer), instance);