Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / whidbey / NetFxQFE / 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
- QuaternionValueSerializer.cs
- HTTPNotFoundHandler.cs
- IdentifierCreationService.cs
- EntityDataSourceState.cs
- OleDbConnection.cs
- FillBehavior.cs
- XmlCharCheckingReader.cs
- ProcessInputEventArgs.cs
- CheckBoxList.cs
- DesignTimeTemplateParser.cs
- HttpSessionStateBase.cs
- ToolStripDropDownButton.cs
- LinkClickEvent.cs
- RowBinding.cs
- ItemDragEvent.cs
- DbParameterCollection.cs
- BindUriHelper.cs
- DataGridViewElement.cs
- RawStylusInputCustomDataList.cs
- InputMethodStateChangeEventArgs.cs
- TableCellCollection.cs
- XmlObjectSerializerReadContextComplexJson.cs
- RequestResponse.cs
- ConfigurationValidatorAttribute.cs
- XPathDocumentNavigator.cs
- TextSchema.cs
- Light.cs
- HttpRuntime.cs
- ToolTipService.cs
- ActiveDocumentEvent.cs
- PartitionerStatic.cs
- TimeSpanConverter.cs
- TriggerAction.cs
- FixedDocument.cs
- coordinator.cs
- __TransparentProxy.cs
- Compiler.cs
- WinOEToolBoxItem.cs
- ThicknessAnimationBase.cs
- BamlTreeNode.cs
- RegexWriter.cs
- FileLoadException.cs
- AdornerHitTestResult.cs
- Authorization.cs
- PageThemeBuildProvider.cs
- AttributeQuery.cs
- MenuEventArgs.cs
- TagPrefixInfo.cs
- ZipIOLocalFileBlock.cs
- FileCodeGroup.cs
- UTF7Encoding.cs
- ImageCodecInfoPrivate.cs
- FixUpCollection.cs
- OutputCacheSection.cs
- Base64Stream.cs
- TextTabProperties.cs
- querybuilder.cs
- TabPage.cs
- KnownIds.cs
- DesignerSerializationVisibilityAttribute.cs
- RuntimeConfigLKG.cs
- _DisconnectOverlappedAsyncResult.cs
- EpmAttributeNameBuilder.cs
- DataControlFieldCell.cs
- Command.cs
- ValidationRule.cs
- ContextMenuStrip.cs
- CssClassPropertyAttribute.cs
- KeyboardDevice.cs
- ListDataBindEventArgs.cs
- DataServiceKeyAttribute.cs
- DataControlLinkButton.cs
- SetterBase.cs
- SrgsDocument.cs
- CompositionAdorner.cs
- XslTransform.cs
- LambdaCompiler.Lambda.cs
- ScrollBar.cs
- CompilationUnit.cs
- DataSourceCollectionBase.cs
- ToolboxComponentsCreatingEventArgs.cs
- OdbcHandle.cs
- VersionedStream.cs
- XmlCharCheckingReader.cs
- EntityClassGenerator.cs
- HwndKeyboardInputProvider.cs
- DataPagerFieldCommandEventArgs.cs
- DaylightTime.cs
- StyleTypedPropertyAttribute.cs
- XmlBufferedByteStreamReader.cs
- ToolboxItem.cs
- GenericParameterDataContract.cs
- TreeBuilderBamlTranslator.cs
- __Filters.cs
- XmlEncodedRawTextWriter.cs
- PartialList.cs
- WmlLiteralTextAdapter.cs
- DynamicRendererThreadManager.cs
- regiisutil.cs
- MissingSatelliteAssemblyException.cs