标签:
使用StreamWriter
using (var writer = new StreamWriter(File.Create(path)))
{
writer.WriteLine("sdf");
}
跳出using后stream也释放了
using (XmlWriter xw = XmlWriter.Create(
File.Create(path),
new XmlWriterSettings() { OmitXmlDeclaration = true }))
{
element.Save(xw);
}
跳出using后stream没释放。。。
解决方法很简单,using套using
using中StreamWriter XmlWriter 区别
标签:
原文地址:http://www.cnblogs.com/beastplus/p/4462443.html