Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / CompMod / System / Diagnostics / BooleanSwitch.cs / 1305376 / 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
- GenericRootAutomationPeer.cs
- IntranetCredentialPolicy.cs
- CodeObject.cs
- SemanticBasicElement.cs
- LiteralTextContainerControlBuilder.cs
- _NetworkingPerfCounters.cs
- AnnotationMap.cs
- ContainerControl.cs
- Win32PrintDialog.cs
- RotateTransform.cs
- ArrayTypeMismatchException.cs
- AsymmetricKeyExchangeDeformatter.cs
- CustomLineCap.cs
- QilParameter.cs
- NamedPipeChannelListener.cs
- TextFormatterHost.cs
- ComboBoxAutomationPeer.cs
- DuplicateDetector.cs
- BinaryConverter.cs
- DocumentViewerAutomationPeer.cs
- MaterialGroup.cs
- HtmlInputReset.cs
- RoleManagerModule.cs
- CodePageEncoding.cs
- ComContractElementCollection.cs
- HttpModuleAction.cs
- SafeHandle.cs
- XPathCompiler.cs
- wpf-etw.cs
- SelectionUIHandler.cs
- Version.cs
- SiteMapProvider.cs
- ChtmlTextBoxAdapter.cs
- CommittableTransaction.cs
- SiteMapDataSource.cs
- PathFigureCollectionValueSerializer.cs
- entityreference_tresulttype.cs
- RecordConverter.cs
- DetailsViewInsertEventArgs.cs
- PropertyValueChangedEvent.cs
- Util.cs
- BoundField.cs
- TreeNode.cs
- ISFTagAndGuidCache.cs
- AttributeAction.cs
- EndpointConfigContainer.cs
- ISFClipboardData.cs
- EncodingNLS.cs
- SqlDataSourceStatusEventArgs.cs
- SerTrace.cs
- XmlNamedNodeMap.cs
- Cursors.cs
- CompilationUtil.cs
- KeyEvent.cs
- RegexMatchCollection.cs
- Grammar.cs
- PrintDialog.cs
- BuildManager.cs
- SplineKeyFrames.cs
- COM2IProvidePropertyBuilderHandler.cs
- WebPartEditorApplyVerb.cs
- PeerName.cs
- EndpointDiscoveryMetadataCD1.cs
- control.ime.cs
- StructuredProperty.cs
- PathBox.cs
- SymbolUsageManager.cs
- Publisher.cs
- CompositeScriptReferenceEventArgs.cs
- WebPartCatalogAddVerb.cs
- HitTestFilterBehavior.cs
- ProfileSettingsCollection.cs
- KnownColorTable.cs
- ControlEvent.cs
- MultilineStringConverter.cs
- _Connection.cs
- IPGlobalProperties.cs
- Visitor.cs
- ImportCatalogPart.cs
- DelayedRegex.cs
- XmlQueryRuntime.cs
- ListBoxItemAutomationPeer.cs
- DictionaryBase.cs
- TrustSection.cs
- AuthorizationRuleCollection.cs
- RowSpanVector.cs
- ColumnPropertiesGroup.cs
- Object.cs
- util.cs
- ImageButton.cs
- InvokePattern.cs
- AdRotator.cs
- IdentifierElement.cs
- HttpApplicationFactory.cs
- TimeZone.cs
- TableCell.cs
- Rotation3DAnimation.cs
- Preprocessor.cs
- NativeMethods.cs
- EventLogger.cs