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
- Point3DConverter.cs
- MeasureItemEvent.cs
- OrderedDictionaryStateHelper.cs
- WebPartConnectionsConfigureVerb.cs
- TextCollapsingProperties.cs
- PropertyConverter.cs
- Win32KeyboardDevice.cs
- DataServiceQueryOfT.cs
- OleAutBinder.cs
- DSACryptoServiceProvider.cs
- HtmlWindowCollection.cs
- EncryptedPackage.cs
- HttpFileCollection.cs
- WebRequest.cs
- UriSection.cs
- LayoutInformation.cs
- RoamingStoreFileUtility.cs
- SimpleType.cs
- StylusPointProperties.cs
- EnvironmentPermission.cs
- WebPartUserCapability.cs
- MouseButtonEventArgs.cs
- DataGridViewAdvancedBorderStyle.cs
- CustomTypeDescriptor.cs
- UnionExpr.cs
- SimpleBitVector32.cs
- KeyPullup.cs
- CursorConverter.cs
- XmlBaseReader.cs
- XmlSchemaObjectTable.cs
- TypefaceMetricsCache.cs
- CngAlgorithmGroup.cs
- WebBrowser.cs
- UmAlQuraCalendar.cs
- RuntimeConfigurationRecord.cs
- ThreadStaticAttribute.cs
- CompressionTransform.cs
- PeerNameResolver.cs
- EmptyQuery.cs
- StubHelpers.cs
- Polygon.cs
- PackUriHelper.cs
- XPathNavigator.cs
- BaseValidator.cs
- reliableinputsessionchannel.cs
- WindowsToolbarItemAsMenuItem.cs
- HwndKeyboardInputProvider.cs
- ObjectDataSourceDesigner.cs
- SelectionItemProviderWrapper.cs
- PageContent.cs
- PanningMessageFilter.cs
- RectangleGeometry.cs
- DataGridLinkButton.cs
- FlowPosition.cs
- ProtocolsConfigurationHandler.cs
- XmlObjectSerializerWriteContextComplex.cs
- KerberosReceiverSecurityToken.cs
- infer.cs
- PageAction.cs
- DoubleCollection.cs
- ActiveXContainer.cs
- WindowInteropHelper.cs
- FileSystemEnumerable.cs
- UInt32Storage.cs
- DesignerActionHeaderItem.cs
- CharacterBufferReference.cs
- WorkflowIdleBehavior.cs
- InheritanceContextHelper.cs
- EarlyBoundInfo.cs
- ServiceParser.cs
- WorkflowHostingResponseContext.cs
- BamlTreeMap.cs
- ClientConvert.cs
- Cursors.cs
- EventKeyword.cs
- DbConnectionPoolIdentity.cs
- SimpleHandlerBuildProvider.cs
- ProfileManager.cs
- FormatException.cs
- RelationshipEnd.cs
- TableColumn.cs
- QueryAccessibilityHelpEvent.cs
- Literal.cs
- Site.cs
- SetterBaseCollection.cs
- IndependentlyAnimatedPropertyMetadata.cs
- BrowserDefinitionCollection.cs
- PatternMatcher.cs
- FixedStringLookup.cs
- TypeInitializationException.cs
- SHA1.cs
- VersionConverter.cs
- SignatureSummaryDialog.cs
- LinqDataSourceDisposeEventArgs.cs
- SqlParameter.cs
- TableLayoutSettingsTypeConverter.cs
- WmlListAdapter.cs
- DbProviderFactoriesConfigurationHandler.cs
- SQLRoleProvider.cs
- RenderDataDrawingContext.cs