'Easiest way to read text file which is locked by another application

I've been using File.ReadAllText() to open a CSV file, but every time I forget to close the file in Excel, the application throws an exception because it can't get access to the file.

(Seems crazy to me, I mean the READ in ReadAllText seems pretty clear)

I know that there is File.Open with all the bells and whistles, but is there an 'intermediate' method which doesn't involve messing around with buffers and char arrays?



Solution 1:[1]

If you want to specify file sharing flags in order to open a file that's in use, you're stuck with File.Open().

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Philippe Leybaert