using (FileStream fs = File.Open(@"C:\logs\log1.txt",FileMode.Append,
FileAccess.Write, FileShare.ReadWrite))
{
using (StreamWriter w = new StreamWriter(fs))
{
w.WriteLine(logMessage);
w.Flush();
isSuccessful = true;
}
}
In code above, I am instantiating a FileStream object so the file is opened in FileShare.ReadWrite mode.
My Question: Does this mean that the code that writes a line to the opened file is going to be thread-safe, Or FileShare.ReadWrite implies something other than thread-safe?