How can I write to a file which is used by another process in C#?
I am able to read the file using FileShare.ReadWrite
, but it only works for FileAccess.Re开发者_Go百科ad
. Does anyone have a solution?
If the other process has write-locked the file, then there's not much you can do, unless you don't mind closing the other process's handle or killing it.
You should read the file contents to a separate Stream and then the file is released.
精彩评论