How to lock a csv file with C#? I have almost the same need for file protection from this link: How to lock a file with C#? What is different?
Encoding sjisX2=Encoding.GetEncoding("Shift_JIS");
StreamWriter arquivo2=new StreamWriter(saveNameTemporaryFull,true,sjisX2);
arquivo2.Write(tb_csvFull.Text);
arquivo2.Close();
//fileProtec.Attributes=FileAttributes.Hidden;
I need to lock the file so it will not open in the period the application is collecting data and saving every minute. Read Only and Hidden does not work, since the user can open the file in excel.