private static string Save(LogLevelSettings logViewerSettings) { using (var stream = new MemoryStream()) { using (var writer = XmlWriter.Create(stream)) { writer.WriteStartDocument(); writer.WriteStartElement("Test"); logViewerSettings.Save(writer); writer.WriteEndElement(); writer.WriteEndDocument(); } return(Encoding.UTF8.GetString(stream.ToArray())); } }