2004-05-19 Gonzalo Paniagua Javier <gonzalo@ximian.com>
[mono.git] / mcs / class / System / System.Diagnostics / BooleanSwitch.cs
1 //
2 // System.Diagnostics.BooleanSwitch.cs
3 //
4 // Author:
5 //      John R. Hicks (angryjohn69@nc.rr.com)
6 //      Jonathan Pryor (jonpryor@vt.edu)
7 //
8 // (C) 2001-2002
9 //
10
11 namespace System.Diagnostics
12 {
13         /// <summary>
14         /// Provides a simple on/off switch that controls debugging
15         /// and tracing output
16         /// </summary>
17         public class BooleanSwitch : Switch
18         {
19                 /// <summary>
20                 /// Initializes a new instance
21                 /// </summary>
22                 public BooleanSwitch(string displayName, string description)
23                         : base(displayName, description)
24                 {
25                 }
26
27                 /// <summary>
28                 /// Specifies whether the switch is enabled or disabled
29                 /// </summary>
30                 public bool Enabled {
31                         // On .NET, any non-zero value is true.  Only 0 is false.
32                         get {return SwitchSetting != 0;}
33                         set {
34                                 SwitchSetting = Convert.ToInt32(value);
35                         }
36                 }
37         }
38 }
39