Does the following close the file after the operation is performed? :
System.IO.File.AppendAllText(path, text);
A yes, no will suffice?
Does the following close the file after the operation is performed? :
System.IO.File.AppendAllText(path, text);
A yes, no will suffice?
Yes, it does.
If it didn't, there'd be no way of closing it afterwards as it doesn't return anything to dispose.
From the docs:
Given a string and a file path, this method opens the specified file, appends the string to the end of the file, and then closes the file.
The other utility methods (ReadAllText
, WriteAllBytes
etc) work the same way.
This is the code of the method:
public static void AppendAllText(string path, string contents, Encoding encoding)
{
using (StreamWriter writer = new StreamWriter(path, true, encoding))
{
writer.Write(contents);
}
}
Therefore, yes.