public string Get(T instance) { using (var stream = new MemoryStream()) { using (var writer = XmlWriter.Create(stream)) { _serializer.Serialize(writer, instance); writer.Flush(); stream.Seek(0, SeekOrigin.Begin); var result = new StreamReader(stream).ReadToEnd(); return(result); } } }