How can I ensure atomicity of a get-and-set operation to redirect Console.Out for logging console output?
I need to intercept the console output stream(s) in order to capture it for a log but still pass things through to the original stream so the application works properly. This obviously means storing the original Console.Out TextWriter before changing it with Console.SetOut(new MyTextWriterClass(originalOut)). I assume the individual op...