Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / whidbey / netfxsp / ndp / fx / src / CompMod / System / Diagnostics / BooleanSwitch.cs / 1 / BooleanSwitch.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- /* */ namespace System.Diagnostics { using System.Diagnostics; using System; using System.Security; using System.Security.Permissions; ////// [SwitchLevel(typeof(bool))] public class BooleanSwitch : Switch { ///Provides a simple on/off switch that can be used to control debugging and tracing /// output. ////// public BooleanSwitch(string displayName, string description) : base(displayName, description) { } public BooleanSwitch(string displayName, string description, string defaultSwitchValue) : base(displayName, description, defaultSwitchValue) { } ///Initializes a new instance of the ////// class. /// public bool Enabled { get { return (SwitchSetting == 0) ? false : true; } [SecurityPermission(SecurityAction.LinkDemand, Flags=SecurityPermissionFlag.UnmanagedCode)] set { SwitchSetting = value ? 1 : 0; } } protected override void OnValueChanged() { bool b; if (Boolean.TryParse(Value, out b)) SwitchSetting = ( b ? 1 : 0); else base.OnValueChanged(); } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. //------------------------------------------------------------------------------ //Specifies whether the switch is enabled /// ( ///) or disabled ( ). // Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- /* */ namespace System.Diagnostics { using System.Diagnostics; using System; using System.Security; using System.Security.Permissions; ////// [SwitchLevel(typeof(bool))] public class BooleanSwitch : Switch { ///Provides a simple on/off switch that can be used to control debugging and tracing /// output. ////// public BooleanSwitch(string displayName, string description) : base(displayName, description) { } public BooleanSwitch(string displayName, string description, string defaultSwitchValue) : base(displayName, description, defaultSwitchValue) { } ///Initializes a new instance of the ////// class. /// public bool Enabled { get { return (SwitchSetting == 0) ? false : true; } [SecurityPermission(SecurityAction.LinkDemand, Flags=SecurityPermissionFlag.UnmanagedCode)] set { SwitchSetting = value ? 1 : 0; } } protected override void OnValueChanged() { bool b; if (Boolean.TryParse(Value, out b)) SwitchSetting = ( b ? 1 : 0); else base.OnValueChanged(); } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007.Specifies whether the switch is enabled /// ( ///) or disabled ( ).
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- RegexNode.cs
- CuspData.cs
- EventLogEntry.cs
- Add.cs
- ActiveXHelper.cs
- FontEmbeddingManager.cs
- DesigntimeLicenseContext.cs
- RegexCharClass.cs
- QuotedPairReader.cs
- CodeIdentifier.cs
- ExpressionLink.cs
- SystemInfo.cs
- ErrorsHelper.cs
- FormViewModeEventArgs.cs
- DeclaredTypeElementCollection.cs
- FacetEnabledSchemaElement.cs
- Keyboard.cs
- HiddenFieldPageStatePersister.cs
- XmlUtil.cs
- PropertyGridEditorPart.cs
- StatusCommandUI.cs
- ModelService.cs
- ScriptControl.cs
- ServiceOperationParameter.cs
- ContextStaticAttribute.cs
- XmlDesigner.cs
- GroupItem.cs
- PatternMatcher.cs
- HighlightComponent.cs
- SlotInfo.cs
- ProfileSection.cs
- DesignConnectionCollection.cs
- Wow64ConfigurationLoader.cs
- ChannelDispatcherBase.cs
- Crypto.cs
- ByteStream.cs
- HeaderedContentControl.cs
- ConfigurationSectionGroup.cs
- HostingEnvironment.cs
- TypeResolver.cs
- documentsequencetextpointer.cs
- ReflectionPermission.cs
- HtmlEmptyTagControlBuilder.cs
- PolyBezierSegment.cs
- DynamicPropertyReader.cs
- EffectiveValueEntry.cs
- _ConnectOverlappedAsyncResult.cs
- CellParagraph.cs
- MetadataUtilsSmi.cs
- XmlWriterSettings.cs
- SafeRightsManagementSessionHandle.cs
- BitSet.cs
- WorkerRequest.cs
- DispatcherProcessingDisabled.cs
- ReliabilityContractAttribute.cs
- ObjectDataSourceMethodEventArgs.cs
- WindowsStatic.cs
- RuntimeVariableList.cs
- SupportsEventValidationAttribute.cs
- TabControl.cs
- TransformerInfo.cs
- RenderTargetBitmap.cs
- TextBoxBase.cs
- NonDualMessageSecurityOverHttpElement.cs
- BufferedReadStream.cs
- DataGridToolTip.cs
- _HeaderInfoTable.cs
- AndCondition.cs
- DecimalConstantAttribute.cs
- FreezableOperations.cs
- SqlClientWrapperSmiStreamChars.cs
- DispatcherFrame.cs
- WorkflowMarkupElementEventArgs.cs
- FilterEventArgs.cs
- AutomationPatternInfo.cs
- RegistrySecurity.cs
- SafeEventLogWriteHandle.cs
- XamlInterfaces.cs
- EnumValAlphaComparer.cs
- DeviceFilterEditorDialog.cs
- Point3DConverter.cs
- KeyFrames.cs
- Calendar.cs
- TargetParameterCountException.cs
- TreeNodeBinding.cs
- TextElementCollectionHelper.cs
- RowUpdatedEventArgs.cs
- WindowsListViewItemCheckBox.cs
- EntityCommand.cs
- PeerDuplexChannelListener.cs
- UrlMappingsModule.cs
- WebPartHeaderCloseVerb.cs
- DesignerSerializerAttribute.cs
- ContextStaticAttribute.cs
- MouseGestureConverter.cs
- MessageVersion.cs
- odbcmetadatacolumnnames.cs
- MDIWindowDialog.cs
- DynamicDiscoSearcher.cs
- CommandValueSerializer.cs