Here is what I mean:
var file = @"myfile"; File.Open(file, FileMode.Open, FileAccess.ReadWrite, FileShare.None); using (StreamReader rdr = new StreamReader(File.Open(file, FileMode.Open, FileAccess.Read, FileShare.Read))) { rdr.ReadToEnd(); } var t = File.ReadAllBytes(file);
Neigther File.Open(file, FileMode.Open, FileAccess.Read, FileShare.Read) and File.ReadAllBytes can read file data.
From my old days of C ++ and winapi, I remember that there was a good way to read locked files if you have backup privileges, but I have no idea how to get and use them in C #.
Can someone provide me with a sample of how to read a file after it is locked?
source share