StreamWriter Share Read Access in Another Process

I have two applications, one is the main application that generates a
log file, the other is an application that reads the log file to compute
statistics.

I want my app that reads the log file to be able to read the file while
the other app is running and generating the log file. If you just use
the default StreamWriter and StreamReader constructors you will get a
file access in error in one of the processes.

You'll notice that the breakpoint on the 2nd process will now work
without getting an IOException. In short this works because the
FileShare
permissions are set properly. You can also read more about the enum
FileMode.