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
- TimeStampChecker.cs
- DesignerTransactionCloseEvent.cs
- SpotLight.cs
- C14NUtil.cs
- NamespaceInfo.cs
- MemberPath.cs
- PolicyException.cs
- PageStatePersister.cs
- ParallelTimeline.cs
- AspCompat.cs
- Bold.cs
- ReadOnlyDataSource.cs
- X509CertificateCollection.cs
- CatalogPartCollection.cs
- ParameterRetriever.cs
- UIPermission.cs
- ObjectItemNoOpAssemblyLoader.cs
- EntityClientCacheEntry.cs
- HotSpot.cs
- grammarelement.cs
- SecurityException.cs
- DataListItemEventArgs.cs
- BinaryKeyIdentifierClause.cs
- LinqExpressionNormalizer.cs
- MemberMemberBinding.cs
- DecoderNLS.cs
- DataGridViewColumnDividerDoubleClickEventArgs.cs
- TableAdapterManagerHelper.cs
- TypeSystemHelpers.cs
- SpeechEvent.cs
- HeaderCollection.cs
- IndentedTextWriter.cs
- ControlsConfig.cs
- XmlSchemaValidator.cs
- If.cs
- IntersectQueryOperator.cs
- SchemaCollectionCompiler.cs
- QueryExpression.cs
- SoapInteropTypes.cs
- XmlSchemaSimpleTypeList.cs
- log.cs
- SecurityRuntime.cs
- EllipseGeometry.cs
- ListViewDeleteEventArgs.cs
- DatatypeImplementation.cs
- MenuItemStyle.cs
- NativeCppClassAttribute.cs
- LocalBuilder.cs
- CannotUnloadAppDomainException.cs
- CornerRadiusConverter.cs
- Exceptions.cs
- InkCanvasSelection.cs
- ContactManager.cs
- BuildProviderCollection.cs
- CryptoProvider.cs
- unitconverter.cs
- PropertyItemInternal.cs
- AnnotationHelper.cs
- HttpClientCertificate.cs
- documentsequencetextcontainer.cs
- MappingMetadataHelper.cs
- HotSpot.cs
- DetailsViewUpdateEventArgs.cs
- ListenerSingletonConnectionReader.cs
- MergeLocalizationDirectives.cs
- DbDataReader.cs
- ObjectStateFormatter.cs
- SchemaEntity.cs
- HttpRawResponse.cs
- Thumb.cs
- AspNetSynchronizationContext.cs
- MaskedTextProvider.cs
- DataGridCommandEventArgs.cs
- MouseButton.cs
- WizardForm.cs
- DesignerExtenders.cs
- WindowsPen.cs
- ClientTargetSection.cs
- CodeDomSerializerBase.cs
- XmlDocumentFragment.cs
- ListBox.cs
- TabItemWrapperAutomationPeer.cs
- ToolStripPanelCell.cs
- ReachSerializationCacheItems.cs
- DeploymentExceptionMapper.cs
- TemplateKey.cs
- Size.cs
- SerialPinChanges.cs
- HwndHostAutomationPeer.cs
- UpdatePanel.cs
- TrustSection.cs
- TimerElapsedEvenArgs.cs
- ContentPlaceHolder.cs
- OleDbReferenceCollection.cs
- DiscoveryDocumentLinksPattern.cs
- InvalidCastException.cs
- RC2.cs
- PromptBuilder.cs
- ButtonPopupAdapter.cs
- EventPropertyMap.cs