关于StreamWriter.Write()的问题
NewTemplatePath = "../default3.html";StreamWriter writefile = new StreamWriter(HttpContext.Current.Server.MapPath(NewTemplatePath), false, Code);
writefile.Write("pagestr");
为什么这么写就不能把数据写进去.而改成下面的写法加上USING就可以呢?
NewTemplatePath = "../default3.html";
using (StreamWriter writefile = new StreamWriter(HttpContext.Current.Server.MapPath(NewTemplatePath), false, Code))
{
writefile.Write("pagestr");
} --------------------编程问答-------------------- 要关掉StreamWriter。
writefile.Close();--------------------编程问答-------------------- 楼上正解!
补充:.NET技术 , ASP.NET