mscorlib(4.0.0.0) API with additions
System.Diagnostics.SourceSwitch Class Reference

Provides a multilevel switch to control tracing and debug output without recompiling your code. More...

Inheritance diagram for System.Diagnostics.SourceSwitch:
[legend]
Collaboration diagram for System.Diagnostics.SourceSwitch:
[legend]

Public Member Functions

 SourceSwitch (string name)
 Initializes a new instance of the T:System.Diagnostics.SourceSwitch class, specifying the name of the source. More...
 
 SourceSwitch (string displayName, string defaultSwitchValue)
 Initializes a new instance of the T:System.Diagnostics.SourceSwitch class, specifying the display name and the default value for the source switch. More...
 
bool ShouldTrace (TraceEventType eventType)
 Determines if trace listeners should be called, based on the trace event type. More...
 

Protected Member Functions

override void OnValueChanged ()
 Invoked when the value of the P:System.Diagnostics.Switch.Value property changes. More...
 
- Protected Member Functions inherited from System.Diagnostics.Switch
 Switch (string displayName, string description)
 Initializes a new instance of the T:System.Diagnostics.Switch class. More...
 
 Switch (string displayName, string description, string defaultSwitchValue)
 Initializes a new instance of the T:System.Diagnostics.Switch class, specifying the display name, description, and default value for the switch. More...
 
virtual internal string [] GetSupportedAttributes ()
 Gets the custom attributes supported by the switch. More...
 
virtual void OnSwitchSettingChanged ()
 Invoked when the P:System.Diagnostics.Switch.SwitchSetting property is changed. More...
 

Properties

SourceLevels Level [get, set]
 Gets or sets the level of the switch. More...
 
- Properties inherited from System.Diagnostics.Switch
StringDictionary Attributes [get]
 Gets the custom switch attributes defined in the application configuration file. More...
 
string Description [get]
 Gets a description of the switch. More...
 
int SwitchSetting [get, set]
 Gets or sets the current setting for this switch. More...
 
string Value [get, set]
 Gets or sets the value of the switch. More...
 

Additional Inherited Members

- Public Attributes inherited from System.Diagnostics.Switch
string DisplayName => displayName
 Gets a name used to identify the switch. More...
 

Detailed Description

Provides a multilevel switch to control tracing and debug output without recompiling your code.

Definition at line 6 of file SourceSwitch.cs.

Constructor & Destructor Documentation

◆ SourceSwitch() [1/2]

System.Diagnostics.SourceSwitch.SourceSwitch ( string  name)

Initializes a new instance of the T:System.Diagnostics.SourceSwitch class, specifying the name of the source.

Parameters
nameThe name of the source.

Definition at line 25 of file SourceSwitch.cs.

◆ SourceSwitch() [2/2]

System.Diagnostics.SourceSwitch.SourceSwitch ( string  displayName,
string  defaultSwitchValue 
)

Initializes a new instance of the T:System.Diagnostics.SourceSwitch class, specifying the display name and the default value for the source switch.

Parameters
displayNameThe name of the source switch.
defaultSwitchValueThe default value for the switch.

Definition at line 33 of file SourceSwitch.cs.

Member Function Documentation

◆ OnValueChanged()

override void System.Diagnostics.SourceSwitch.OnValueChanged ( )
protectedvirtual

Invoked when the value of the P:System.Diagnostics.Switch.Value property changes.

Exceptions
T:System.ArgumentExceptionThe new value of P:System.Diagnostics.Switch.Value is not one of the T:System.Diagnostics.SourceLevels values.

Reimplemented from System.Diagnostics.Switch.

Definition at line 49 of file SourceSwitch.cs.

◆ ShouldTrace()

bool System.Diagnostics.SourceSwitch.ShouldTrace ( TraceEventType  eventType)

Determines if trace listeners should be called, based on the trace event type.

Parameters
eventTypeOne of the T:System.Diagnostics.TraceEventType values.
Returns
True if the trace listeners should be called; otherwise, false.

Definition at line 42 of file SourceSwitch.cs.

Property Documentation

◆ Level

SourceLevels System.Diagnostics.SourceSwitch.Level
getset

Gets or sets the level of the switch.

Returns
One of the T:System.Diagnostics.SourceLevels values that represents the event level of the switch.

Definition at line 11 of file SourceSwitch.cs.


The documentation for this class was generated from the following file: