<?xml version="1.0" encoding="utf-8"?>
<Type Name="BooleanSwitch" FullName="System.Diagnostics.BooleanSwitch">
  <TypeSignature Language="C#" Value="public class BooleanSwitch : System.Diagnostics.Switch" Maintainer="auto" />
  <TypeSignature Language="ILAsm" Value=".class public auto ansi beforefieldinit BooleanSwitch extends System.Diagnostics.Switch" />
  <AssemblyInfo>
    <AssemblyName>System</AssemblyName>
    <AssemblyPublicKey>[00 00 00 00 00 00 00 00 04 00 00 00 00 00 00 00]</AssemblyPublicKey>
    <AssemblyVersion>1.0.3300.0</AssemblyVersion>
    <AssemblyVersion>1.0.5000.0</AssemblyVersion>
    <AssemblyVersion>2.0.0.0</AssemblyVersion>
    <AssemblyVersion>4.0.0.0</AssemblyVersion>
  </AssemblyInfo>
  <ThreadSafetyStatement>Gtk# is thread aware, but not thread safe; See the &lt;link location="node:gtk-sharp/programming/threads"&gt;Gtk# Thread Programming&lt;/link&gt; for details.</ThreadSafetyStatement>
  <Base>
    <BaseTypeName>System.Diagnostics.Switch</BaseTypeName>
  </Base>
  <Interfaces />
  <Attributes>
    <Attribute>
      <AttributeName>System.Diagnostics.SwitchLevel(typeof(System.Boolean))</AttributeName>
    </Attribute>
  </Attributes>
  <Docs>
    <remarks>
      <attribution license="cc4" from="Microsoft" modified="false" />
      <para>You can use a Boolean trace switch to enable or disable messages based on their importance. Use the <see cref="P:System.Diagnostics.BooleanSwitch.Enabled" /> property to get the current value of the switch.</para>
      <para>You can enable or disable a <see cref="T:System.Diagnostics.BooleanSwitch" /> through the application configuration file and then use the configured <see cref="T:System.Diagnostics.BooleanSwitch" /> value in your application. Alternately, you can create a <see cref="T:System.Diagnostics.BooleanSwitch" /> in your code and set the <see cref="P:System.Diagnostics.BooleanSwitch.Enabled" /> property directly to instrument a specific section of code.</para>
      <para>To configure a <see cref="T:System.Diagnostics.BooleanSwitch" />, edit the configuration file that corresponds to the name of your application. Within this file, you can add or remove a switch, set a switch's value, or clear all the switches previously set by the application. The configuration file should be formatted like the following example.</para>
      <code>&lt;configuration&gt;
  &lt;system.diagnostics&gt;
    &lt;switches&gt;
      &lt;add name="mySwitch" value="1"/&gt;
    &lt;/switches&gt;
  &lt;/system.diagnostics&gt;
&lt;/configuration&gt;</code>
      <para>This example configuration section defines a <see cref="T:System.Diagnostics.BooleanSwitch" /> with the <see cref="P:System.Diagnostics.Switch.DisplayName" /> property set to mySwitch and the <see cref="P:System.Diagnostics.BooleanSwitch.Enabled" /> value set to true. Within your application, you can use the configured switch value by creating a <see cref="T:System.Diagnostics.BooleanSwitch" /> with the same name, as shown in the following code example.</para>
      <para>code reference: Classic BooleanSwitch.BooleanSwitch Example#2</para>
      <para>By default, the <see cref="P:System.Diagnostics.BooleanSwitch.Enabled" /> property is set using the value specified in the configuration file. Configure the switch with a value of 0 to set the <see cref="P:System.Diagnostics.BooleanSwitch.Enabled" /> property to false; configure the switch with a nonzero value to set the <see cref="P:System.Diagnostics.BooleanSwitch.Enabled" /> property to true. If the <see cref="T:System.Diagnostics.BooleanSwitch" /> constructor cannot find initial switch settings in the configuration file, the <see cref="P:System.Diagnostics.BooleanSwitch.Enabled" /> property of the new switch is set to false by default.</para>
      <para>You must enable tracing or debugging to use a switch. The following syntax is compiler specific. If you use compilers other than C# or Visual Basic, refer to the documentation for your compiler.</para>
      <list type="bullet">
        <item>
          <para>To enable debugging in C#, add the /d:DEBUG flag to the compiler command line when you compile your code, or you can add #define DEBUG to the top of your file. In Visual Basic, add the /d:DEBUG=True flag to the compiler command line.</para>
        </item>
        <item>
          <para>To enable tracing in C#, add the /d:TRACE flag to the compiler command line when you compile your code, or add #define TRACE to the top of your file. In Visual Basic, add the /d:TRACE=True flag to the compiler command line.</para>
        </item>
      </list>
      <block subset="none" type="note">
        <para>These debug and trace compiler switches are not required when using the <see cref="T:System.Diagnostics.BooleanSwitch" /> class in isolation. They are only required in conjunction with <see cref="T:System.Diagnostics.Trace" /> or <see cref="T:System.Diagnostics.Debug" /> methods that are conditionally compiled.</para>
      </block>
      <para>For more information on instrumenting your application, see <see cref="T:System.Diagnostics.Debug" /> and <see cref="T:System.Diagnostics.Trace" />. For more information about configuring and using trace switches, see <format type="text/html"><a href="8ab913aa-f400-4406-9436-f45bc6e54fbe">Trace Switches</a></format>.</para>
      <block subset="none" type="note">
        <para>To improve performance, you can make <see cref="T:System.Diagnostics.BooleanSwitch" /> members static in your class.</para>
      </block>
    </remarks>
    <summary>
      <attribution license="cc4" from="Microsoft" modified="false" />
      <para>Provides a simple on/off switch that controls debugging and tracing output.</para>
    </summary>
  </Docs>
  <Members>
    <Member MemberName=".ctor">
      <MemberSignature Language="C#" Value="public BooleanSwitch (string displayName, string description);" />
      <MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor(string displayName, string description) cil managed" />
      <MemberType>Constructor</MemberType>
      <AssemblyInfo>
        <AssemblyVersion>1.0.5000.0</AssemblyVersion>
        <AssemblyVersion>2.0.0.0</AssemblyVersion>
        <AssemblyVersion>4.0.0.0</AssemblyVersion>
      </AssemblyInfo>
      <ReturnValue />
      <Parameters>
        <Parameter Name="displayName" Type="System.String" />
        <Parameter Name="description" Type="System.String" />
      </Parameters>
      <Docs>
        <remarks>
          <attribution license="cc4" from="Microsoft" modified="false" />
          <para>When you create a <see cref="T:System.Diagnostics.BooleanSwitch" />, the <paramref name="displayName" /> parameter is used to find initial switch settings. If the constructor cannot find initial settings, the <see cref="P:System.Diagnostics.BooleanSwitch.Enabled" /> property is set to false (disabled).</para>
          <para>To set the level of your <see cref="T:System.Diagnostics.BooleanSwitch" />, edit the configuration file corresponding to the name of your application. Within this file, you can add a switch and set its value, remove a switch, or clear all switches previously set by the application. The configuration file should be formatted like the following example: </para>
          <code> &lt;configuration&gt;
     &lt;system.diagnostics&gt;
        &lt;switches&gt;
           &lt;add name="mySwitch" value="10" /&gt;
           &lt;add name="myNewSwitch" value="20" /&gt;
           &lt;remove name="mySwitch" /&gt;
           &lt;clear/&gt;
        &lt;/switches&gt;
     &lt;/system.diagnostics&gt;
  &lt;/configuration&gt;</code>
          <block subset="none" type="note">
            <para>The switches you created should be static.</para>
          </block>
        </remarks>
        <summary>
          <attribution license="cc4" from="Microsoft" modified="false" />
          <para>Initializes a new instance of the <see cref="T:System.Diagnostics.BooleanSwitch" /> class with the specified display name and description.</para>
        </summary>
        <param name="displayName">
          <attribution license="cc4" from="Microsoft" modified="false" />The name to display on a user interface. </param>
        <param name="description">
          <attribution license="cc4" from="Microsoft" modified="false" />The description of the switch. </param>
      </Docs>
    </Member>
    <Member MemberName=".ctor">
      <MemberSignature Language="C#" Value="public BooleanSwitch (string displayName, string description, string defaultSwitchValue);" />
      <MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor(string displayName, string description, string defaultSwitchValue) cil managed" />
      <MemberType>Constructor</MemberType>
      <AssemblyInfo>
        <AssemblyVersion>2.0.0.0</AssemblyVersion>
        <AssemblyVersion>4.0.0.0</AssemblyVersion>
      </AssemblyInfo>
      <Parameters>
        <Parameter Name="displayName" Type="System.String" />
        <Parameter Name="description" Type="System.String" />
        <Parameter Name="defaultSwitchValue" Type="System.String" />
      </Parameters>
      <Docs>
        <remarks>
          <attribution license="cc4" from="Microsoft" modified="false" />
          <para>The <paramref name="displayName" /> parameter is used to set the value of the <see cref="P:System.Diagnostics.Switch.DisplayName" /> property, and the <paramref name="description" /> parameter is use to set the value of the <see cref="P:System.Diagnostics.Switch.Description" /> property. The <paramref name="defaultSwitchValue" /> parameter is saved as a field and used to initialize the <see cref="P:System.Diagnostics.Switch.Value" /> property on first reference. For more information about constructor use, see the <see cref="M:System.Diagnostics.BooleanSwitch.#ctor(System.String,System.String)" /> constructor.</para>
        </remarks>
        <summary>
          <attribution license="cc4" from="Microsoft" modified="false" />
          <para>Initializes a new instance of the <see cref="T:System.Diagnostics.BooleanSwitch" /> class with the specified display name, description, and default switch value. </para>
        </summary>
        <param name="displayName">
          <attribution license="cc4" from="Microsoft" modified="false" />The name to display on the user interface. </param>
        <param name="description">
          <attribution license="cc4" from="Microsoft" modified="false" />The description of the switch. </param>
        <param name="defaultSwitchValue">
          <attribution license="cc4" from="Microsoft" modified="false" />The default value of the switch.</param>
      </Docs>
    </Member>
    <Member MemberName="Enabled">
      <MemberSignature Language="C#" Value="public bool Enabled { get; set; }" />
      <MemberSignature Language="ILAsm" Value=".property instance bool Enabled" />
      <MemberType>Property</MemberType>
      <AssemblyInfo>
        <AssemblyVersion>1.0.5000.0</AssemblyVersion>
        <AssemblyVersion>2.0.0.0</AssemblyVersion>
        <AssemblyVersion>4.0.0.0</AssemblyVersion>
      </AssemblyInfo>
      <ReturnValue>
        <ReturnType>System.Boolean</ReturnType>
      </ReturnValue>
      <Parameters>
      </Parameters>
      <Docs>
        <value>To be added: an object of type 'bool'</value>
        <remarks>
          <attribution license="cc4" from="Microsoft" modified="false" />
          <para>By default, this field is set to false (disabled). To enable the switch, assign this field the value of true. To disable the switch, assign the value to false.  The value of this property is determined by the value of the base class property <see cref="P:System.Diagnostics.Switch.SwitchSetting" />.</para>
          <block subset="none" type="note">
            <para>This method uses the <see cref="F:System.Security.Permissions.SecurityAction.LinkDemand" /> flag to prevent being called from untrusted code; only the immediate caller is required to have <see cref="P:System.Security.Permissions.SecurityPermissionAttribute.UnmanagedCode" /> permission. If your code can be called from partially trusted code, do not pass the user input to <see cref="T:System.Runtime.InteropServices.Marshal" /> class methods without validation. For important limitations on using the LinkDemand member, see <format type="text/html"><a href="1ab877f2-70f4-4e0d-8116-943999dfe8f5">Demand vs. LinkDemand</a></format>.</para>
          </block>
        </remarks>
        <summary>
          <attribution license="cc4" from="Microsoft" modified="false" />
          <para>Gets or sets a value indicating whether the switch is enabled or disabled.</para>
        </summary>
      </Docs>
    </Member>
    <Member MemberName="OnValueChanged">
      <MemberSignature Language="C#" Value="protected override void OnValueChanged ();" />
      <MemberSignature Language="ILAsm" Value=".method familyhidebysig virtual instance void OnValueChanged() cil managed" />
      <MemberType>Method</MemberType>
      <AssemblyInfo>
        <AssemblyVersion>2.0.0.0</AssemblyVersion>
        <AssemblyVersion>4.0.0.0</AssemblyVersion>
      </AssemblyInfo>
      <ReturnValue>
        <ReturnType>System.Void</ReturnType>
      </ReturnValue>
      <Parameters />
      <Docs>
        <remarks>
          <attribution license="cc4" from="Microsoft" modified="false" />
          <para>The <see cref="M:System.Diagnostics.BooleanSwitch.OnValueChanged" /> method determines whether the new value is a valid string representation of a Boolean value ("false" or "true"). If so, the method sets the <see cref="P:System.Diagnostics.Switch.SwitchSetting" /> property to 0 or 1.  Otherwise, the base method is called, which converts the string value to an integer value, which is then used to set the <see cref="P:System.Diagnostics.Switch.SwitchSetting" /> property.</para>
        </remarks>
        <summary>
          <attribution license="cc4" from="Microsoft" modified="false" />
          <para>Determines whether the new value of the <see cref="P:System.Diagnostics.Switch.Value" /> property can be parsed as a Boolean value.</para>
        </summary>
      </Docs>
    </Member>
  </Members>
</Type>