You can use settings in your application configuration file to enable or disable a switch at startup. This can also be done programmatically.
You can set the switch's initial setting in the application's configuration file.
<?xml version="1.0"?> <configuration> <system.diagnostics> <trace indentsize="15" /> <switches> <add name="DebugSwitch" value = "1" /> <add name="TraceSwitch" value = "2" /> </switches> </system.diagnostics> </configuration>
If no values are found, the initial value of the DebugSwitch's Enabled property is set to false and the TraceSwitch's Level property is set to off.
The Enabled property of the DebugSwitch can be set to true ...