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
- Site.cs
- TemplateControlBuildProvider.cs
- DataListItemCollection.cs
- DtdParser.cs
- SQLResource.cs
- ActiveXContainer.cs
- GenericRootAutomationPeer.cs
- Interfaces.cs
- InternalConfigConfigurationFactory.cs
- EmptyImpersonationContext.cs
- AttachedPropertyMethodSelector.cs
- Schema.cs
- PaperSize.cs
- _NegoState.cs
- ReadOnlyCollection.cs
- ImageList.cs
- SqlWebEventProvider.cs
- XmlSchemaDatatype.cs
- latinshape.cs
- IBuiltInEvidence.cs
- RoutingExtensionElement.cs
- SynchronousReceiveElement.cs
- DateTimeValueSerializerContext.cs
- TcpChannelFactory.cs
- HtmlTableCell.cs
- FontFamily.cs
- ZoomPercentageConverter.cs
- DataGridClipboardHelper.cs
- AsymmetricSignatureFormatter.cs
- BinHexDecoder.cs
- SemanticAnalyzer.cs
- WebPartPersonalization.cs
- ScriptReferenceBase.cs
- ClosableStream.cs
- ComplexTypeEmitter.cs
- LinearGradientBrush.cs
- WinFormsSecurity.cs
- UnrecognizedPolicyAssertionElement.cs
- DashStyle.cs
- DataGridViewSelectedCellsAccessibleObject.cs
- ColorMap.cs
- ListMarkerLine.cs
- RuntimeWrappedException.cs
- DNS.cs
- GestureRecognitionResult.cs
- AuthenticationService.cs
- HtmlWindow.cs
- ObjectTag.cs
- CalendarDateChangedEventArgs.cs
- DiscreteKeyFrames.cs
- InvalidateEvent.cs
- PaintValueEventArgs.cs
- CachedPathData.cs
- Variable.cs
- SafeRightsManagementQueryHandle.cs
- ImageClickEventArgs.cs
- RoutingChannelExtension.cs
- UnitySerializationHolder.cs
- RTTrackingProfile.cs
- ConnectionPointCookie.cs
- BevelBitmapEffect.cs
- TopClause.cs
- ToolStripRendererSwitcher.cs
- JsonFormatWriterGenerator.cs
- ScriptReference.cs
- MyContact.cs
- Expressions.cs
- SkewTransform.cs
- TextEffect.cs
- ParameterBuilder.cs
- PagerSettings.cs
- TreeView.cs
- DescriptionAttribute.cs
- FontStyles.cs
- TableSectionStyle.cs
- SchemaAttDef.cs
- PrivilegedConfigurationManager.cs
- FreeFormDesigner.cs
- AccessControlList.cs
- DirectionalLight.cs
- RadioButtonRenderer.cs
- WebPartEventArgs.cs
- DeploymentExceptionMapper.cs
- CodeTypeDeclaration.cs
- IdentityValidationException.cs
- UserMapPath.cs
- XmlAttributeProperties.cs
- Visual.cs
- Lasso.cs
- WriteTimeStream.cs
- EditingCoordinator.cs
- Literal.cs
- BehaviorDragDropEventArgs.cs
- LabelEditEvent.cs
- LicenseContext.cs
- PreviewKeyDownEventArgs.cs
- Polyline.cs
- TagNameToTypeMapper.cs
- ContainerControl.cs
- IconEditor.cs