Skip navigation

User-Defined Switch to control Debug and Trace

The Switch class nicely encapsulates getting the switch value from the registry, so it’s easy to derive a custom switch if the values of TraceSwitch don't work well. The following example implementsSpecialSwitch , which implements the Mute , Terse , Verbose , and Chatty  logging levels:

Let us  see the code sample.

Hide comments

Comments

  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
Publish