You could use delegates to solve this problem although I'm sure checking bools is probably significantly faster than Console.WriteLine()
.
Add a delegate to the class:
public delegate void Output(string message);
Then at the start of the application you can check your bool and assign which method to run depending on if you want to actually write or not.
bool logInformation = true;
if(logInformation)
{
ProcessInformation((s) => { Console.WriteLine(s); });
}
else
{
ProcessInformation((s) => { });
}
And finally add the delegate to your method signature for your processing method.
private void ProcessInformation(Output logger)
{
// doing stuff, time to write
logger("test");
}
You'll need to replace your Console.WriteLine calls with logger() but that will allow you to run things without worrying about checking a bool each time. That said I don't know if it's actually faster than checking a bool each time but probably easier to implement and maintain.