Code:
/ DotNET / DotNET / 8.0 / untmp / whidbey / REDBITS / 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(); } } }Specifies whether the switch is enabled /// ( ///) or disabled ( ).
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- ReachIDocumentPaginatorSerializerAsync.cs
- SocketConnection.cs
- Inflater.cs
- TextDecorationLocationValidation.cs
- StylusButton.cs
- TlsnegoTokenProvider.cs
- ObjectItemNoOpAssemblyLoader.cs
- SafeNativeHandle.cs
- DataGridViewTextBoxColumn.cs
- XNodeSchemaApplier.cs
- ClientEventManager.cs
- PointIndependentAnimationStorage.cs
- XmlSerializerFactory.cs
- Unit.cs
- ContainerControl.cs
- CursorConverter.cs
- EntitySetBase.cs
- ApplyImportsAction.cs
- BordersPage.cs
- ProcessHostFactoryHelper.cs
- TabRenderer.cs
- DecryptRequest.cs
- GeometryConverter.cs
- OleDbCommandBuilder.cs
- WinEventQueueItem.cs
- Triplet.cs
- CodeValidator.cs
- AxisAngleRotation3D.cs
- FixedFlowMap.cs
- COM2IDispatchConverter.cs
- AssemblyBuilderData.cs
- SwitchCase.cs
- ClientEventManager.cs
- WebPermission.cs
- TreeSet.cs
- DirectoryInfo.cs
- DataServiceClientException.cs
- ContentPropertyAttribute.cs
- HtmlElement.cs
- Main.cs
- Clipboard.cs
- QuaternionValueSerializer.cs
- RelatedPropertyManager.cs
- ToolStripContentPanel.cs
- PerformanceCounterPermission.cs
- SystemKeyConverter.cs
- XLinq.cs
- PathGeometry.cs
- remotingproxy.cs
- XmlCharCheckingReader.cs
- Visual3D.cs
- ComplexPropertyEntry.cs
- MsdtcClusterUtils.cs
- IISUnsafeMethods.cs
- TextRange.cs
- UIElementPropertyUndoUnit.cs
- BitmapEffectState.cs
- X509ChainPolicy.cs
- WebPartConnectionsDisconnectVerb.cs
- ServiceInfo.cs
- OdbcRowUpdatingEvent.cs
- HiddenFieldPageStatePersister.cs
- HttpServerVarsCollection.cs
- DesignerCategoryAttribute.cs
- ArrayHelper.cs
- ButtonRenderer.cs
- DefaultParameterValueAttribute.cs
- StreamWriter.cs
- Collection.cs
- DataGridViewRowHeightInfoPushedEventArgs.cs
- FactoryGenerator.cs
- PageCodeDomTreeGenerator.cs
- NodeFunctions.cs
- DataServiceContext.cs
- IDictionary.cs
- TypeNameHelper.cs
- UInt16.cs
- JsonReaderWriterFactory.cs
- WsdlHelpGeneratorElement.cs
- TextEditorTyping.cs
- TransformationRules.cs
- DBSqlParserTableCollection.cs
- FileDialog.cs
- EntityTypeBase.cs
- DeploymentExceptionMapper.cs
- InvokeGenerator.cs
- StateDesigner.Layouts.cs
- ActivityTrace.cs
- Int32Storage.cs
- EdmTypeAttribute.cs
- CornerRadiusConverter.cs
- OverflowException.cs
- TextRangeProviderWrapper.cs
- TemplatingOptionsDialog.cs
- ToolStripPanel.cs
- XmlSchemaInferenceException.cs
- MetadataArtifactLoaderFile.cs
- BlurBitmapEffect.cs
- FuncTypeConverter.cs
- ImageCreator.cs