I am reading a text file using StreamReader. If while I have that stream
open I open the underlying text file in, say, Excel, Excel will announce that
the file is locked for reading and will offer to open it in Read-Only mode.
But if I do that, then my StreamReader immediately throws a
System.IO.IOException announcing, "The process cannot access the file because
another process has locked a portion of the file."
How can I access a file with a StreamReader in such a way that the file is
locked for reading AND it doesn't fail if another process also tries to
access the file in read-only mode?