mscorlib(4.0.0.0) API with additions
SourceSwitch.cs
2 
3 namespace System.Diagnostics
4 {
6  public class SourceSwitch : Switch
7  {
10  public SourceLevels Level
11  {
12  get
13  {
14  return (SourceLevels)base.SwitchSetting;
15  }
16  [SecurityPermission(SecurityAction.LinkDemand, Flags = SecurityPermissionFlag.UnmanagedCode)]
17  set
18  {
19  base.SwitchSetting = (int)value;
20  }
21  }
22 
25  public SourceSwitch(string name)
26  : base(name, string.Empty)
27  {
28  }
29 
33  public SourceSwitch(string displayName, string defaultSwitchValue)
34  : base(displayName, string.Empty, defaultSwitchValue)
35  {
36  }
37 
42  public bool ShouldTrace(TraceEventType eventType)
43  {
44  return (base.SwitchSetting & (int)eventType) != 0;
45  }
46 
49  protected override void OnValueChanged()
50  {
51  base.SwitchSetting = (int)Enum.Parse(typeof(SourceLevels), base.Value, ignoreCase: true);
52  }
53  }
54 }
Describes a set of security permissions applied to code. This class cannot be inherited.
override void OnValueChanged()
Invoked when the value of the P:System.Diagnostics.Switch.Value property changes.
Definition: SourceSwitch.cs:49
SourceSwitch(string displayName, string defaultSwitchValue)
Initializes a new instance of the T:System.Diagnostics.SourceSwitch class, specifying the display nam...
Definition: SourceSwitch.cs:33
SourceSwitch(string name)
Initializes a new instance of the T:System.Diagnostics.SourceSwitch class, specifying the name of the...
Definition: SourceSwitch.cs:25
Definition: __Canon.cs:3
bool ShouldTrace(TraceEventType eventType)
Determines if trace listeners should be called, based on the trace event type.
Definition: SourceSwitch.cs:42
static object Parse(Type enumType, string value)
Converts the string representation of the name or numeric value of one or more enumerated constants t...
Definition: Enum.cs:298
SecurityAction
Specifies the security actions that can be performed using declarative security.
Provides the base class for enumerations.
Definition: Enum.cs:14
TraceEventType
Identifies the type of event that has caused the trace.
SourceLevels Level
Gets or sets the level of the switch.
Definition: SourceSwitch.cs:11
SourceLevels
Specifies the levels of trace messages filtered by the source switch and event type filter.
Definition: SourceLevels.cs:7
Provides a multilevel switch to control tracing and debug output without recompiling your code.
Definition: SourceSwitch.cs:6
SecurityPermissionFlag
Specifies access flags for the security permission object.
Provides an abstract base class to create new debugging and tracing switches.
Definition: Switch.cs:10