Using BooleanSwitch : Debug Trace « Development Class « C# / C Sharp






Using BooleanSwitch

Using BooleanSwitch
 
/*
 * C# Programmers Pocket Consultant
 * Author: Gregory S. MacBeth
 * Email: gmacbeth@comporium.net
 * Create Date: June 27, 2003
 * Last Modified Date:
 * Version: 1
 */
using System;
using System.IO;
using System.Diagnostics;


namespace Client.Chapter_16___Debugging
{
  public class UsingBooleanSwitch
  {
    static BooleanSwitch MySwitch = new BooleanSwitch("MyData", "MyModule");
    [STAThread]
    static void Main(string[] args)
    {
      MySwitch.Enabled = true;
      if (MySwitch.Enabled)
        Console.WriteLine("Error happened!");
    }
  }
}

           
         
  








Related examples in the same category

1.Debug class
2.Debug and ProfileDebug and Profile
3.Trace to event log
4.Trace to debuger: writeline and flush
5.Trace class: listener and writeline
6.Tracing To A File
7.Tracing Example
8.demonstrates debug outputdemonstrates debug output
9.illustrate the use of the debuggerillustrate the use of the debugger
10.A simple demonstration of the Debug class
11.Demonstrate indenting debug messages
12.Demonstrates routing debug messages to a fileDemonstrates routing debug messages to a file
13.Defensive Programming:Conditional Methods
14.Debug and Trace Output
15.Using Switches to Control Debug and Trace:BooleanSwitch
16.Using Switches to Control Debug and Trace:TraceSwitch
17.Using Switches to Control Debug and Trace:User-Defined Switch
18.Object Dumper