C#技巧之缩进输出XML文档到TextBox
今天在写一个工具时候突然用到了Xml,并且要输出到TextBox中,于是就写了一下啊,上网一看还挺多人问这问题,于是晒一下@_@!
StringBuilder sb = new StringBuilder();
StringWriter sw = new StringWriter(sb);
XmlTextWriter writer = new XmlTextWriter(sw);
writer.Formatting = Formatting.Indented;
writer.Indentation = 4;
writer.IndentChar = ' ';
doc.WriteContentTo(writer);
editResult.Text = sb.ToString();
相关的文章在这里
将想法付诸于实践,借此来影响他人是一个人存在的真正价值