I am getting error in my C# program then I try to write a file with
new StreamWriter("myFile.dat");
This program gets executed by other one and sometimes previous instance of the program blocks the file (don’t know how and why).
Can I write the file anyway with any kind of unblocikng in my code?
You can try opening a FileStream with FileShare.ReadWrite flag. E.g:
The gives more than one process the ability to write to the file.