Name
Switch
Synopsis
Consult this class in a conditional statement to execute
special tracing or debugging code. To
use a switch you must have debugging enabled. Each Switch
has a DisplayName
and Description
. SwitchSetting
contains the current setting.
Specify the value of a switch in the application configuration
file. Under the <system.diagnostics>
element, add an element <switches>
to hold all the switches.
Within the <switches>
element, define each switch you
want with <add name="switchname" value="value"/>
. For a BooleanSwitch
, any nonzero value sets BooleanSwitch.Enabled
to true
. For a TraceSwitch
, use a value from the TraceLevel
enumeration.
Public MustInherit Class Switch ' Protected Constructors Protected Sub New(ByVal displayName As String, ByVal description As String) ' Public Instance Properties Public ReadOnly Property Description As String Public ReadOnly Property DisplayName As String ' Protected Instance Properties Protected Property SwitchSetting As Integer ' Protected Instance Methods Overridable Protected Sub OnSwitchSettingChanged() End Class
Subclasses
BooleanSwitch
, TraceSwitch
Get VB.NET Core Classes in a Nutshell now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.