NGWS SDK Documentation  

This is preliminary documentation and subject to change.
To comment on this topic, please send us email at ngwssdk@microsoft.com. Thanks!

BooleanSwitch Class

Provides a simple on/off switch that can be used to control debugging and tracing output.

Object
   Switch
      BooleanSwitch

[Visual Basic]
Public Class BooleanSwitch
   Inherits Switch
[C#]
public class BooleanSwitch : Switch
[C++]
public __gc class BooleanSwitch : public Switch
[JScript]
public class BooleanSwitch extends Switch

Remarks

When the System.Diagnostics.BooleanSwitch constructor cannot find initial switch settings in the registry or in environmental variables, the new switch is set to disabled (false) by default. To enable a disabled switch, call the SetSwitchSetting method with a value other than zero ("0").

To find out if a switch is enabled or disabled, access the Enabled field.

For more information, see <DebugTopicTBD>.

Requirements

Namespace: System.Diagnostics

Assembly: System.dll

Example [Visual Basic]

The following example creates a BooleanSwitch which controls the debug output of MyMethod.

[Visual Basic]

Dim traceParams As BooleanSwitch
Assign traceParams As BooleanSwitch("traceParams","tracing of function params")
...
Public Function MyMethod(a As Integer, b As String) As String
   If traceParams.Enabled Then
      Debug.WriteLine "MyMethod( " & a & " , " & b & " ) called"
   End If
   ...
End Function

See Also

BooleanSwitch Members | System.Diagnostics Namespace | Switch | TraceSwitch | Debug | Trace