执行操作后,以下是否关闭文件?:
System.IO.File.AppendAllText(path, text);
Run Code Online (Sandbox Code Playgroud)
是的,不,不够吗?
这是方法的代码:
public static void AppendAllText(string path, string contents, Encoding encoding)
{
using (StreamWriter writer = new StreamWriter(path, true, encoding))
{
writer.Write(contents);
}
}
Run Code Online (Sandbox Code Playgroud)
因此,是的.