Here's what I have in mind:
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)
nor File.ReadAllBytes
can read file data.
From my old c++ and winapi days, I do remember, that there used to be a good way to read locked files, if you have backup priviledges, but I have no idea how obtain and use those in c#.
Can anyone provide me with a sample on how to read a file after it has been locked?