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
- PeerMaintainer.cs
- DesignerCommandSet.cs
- XmlQualifiedNameTest.cs
- LinkLabel.cs
- GridItemProviderWrapper.cs
- _ReceiveMessageOverlappedAsyncResult.cs
- FormsAuthenticationModule.cs
- PropertyFilterAttribute.cs
- AddInSegmentDirectoryNotFoundException.cs
- CursorEditor.cs
- CellLabel.cs
- PropertyPushdownHelper.cs
- LogLogRecord.cs
- CryptoHandle.cs
- ParenthesizePropertyNameAttribute.cs
- ActivityBindForm.Designer.cs
- CustomExpressionEventArgs.cs
- SchemaContext.cs
- ProcessModule.cs
- XmlTextAttribute.cs
- HelpEvent.cs
- MsmqIntegrationInputMessage.cs
- HeaderedContentControl.cs
- FormClosingEvent.cs
- BindingSourceDesigner.cs
- NumericPagerField.cs
- XmlSerializationWriter.cs
- ScrollItemProviderWrapper.cs
- XmlNavigatorStack.cs
- Roles.cs
- ProcessThreadCollection.cs
- DataGridViewAutoSizeModeEventArgs.cs
- IsolatedStoragePermission.cs
- SqlIdentifier.cs
- HttpSocketManager.cs
- SqlCachedBuffer.cs
- InvalidFilterCriteriaException.cs
- ApplicationServiceHelper.cs
- XmlSerializationGeneratedCode.cs
- WebContext.cs
- COM2TypeInfoProcessor.cs
- TreeIterator.cs
- MailHeaderInfo.cs
- CompleteWizardStep.cs
- CodeTypeParameterCollection.cs
- BrowserDefinitionCollection.cs
- MemoryStream.cs
- XsdBuilder.cs
- SchemaCollectionCompiler.cs
- TreeNode.cs
- WorkflowClientDeliverMessageWrapper.cs
- ScrollItemProviderWrapper.cs
- EventLogPermissionEntry.cs
- DataGridViewLinkColumn.cs
- SettingsSavedEventArgs.cs
- IdleTimeoutMonitor.cs
- TextFindEngine.cs
- Binding.cs
- XamlSerializerUtil.cs
- SessionSwitchEventArgs.cs
- WindowAutomationPeer.cs
- ConnectionPointCookie.cs
- ModelUIElement3D.cs
- IEnumerable.cs
- _Semaphore.cs
- HTMLTagNameToTypeMapper.cs
- NavigationPropertyEmitter.cs
- PeerCollaborationPermission.cs
- CalendarTable.cs
- DataBinding.cs
- HtmlSelect.cs
- StatusBarDrawItemEvent.cs
- Constraint.cs
- PlatformNotSupportedException.cs
- GeneratedContractType.cs
- PostBackOptions.cs
- XmlQualifiedName.cs
- Int32Storage.cs
- DbExpressionRules.cs
- ToolTip.cs
- oledbconnectionstring.cs
- DeobfuscatingStream.cs
- Enlistment.cs
- cache.cs
- Aggregates.cs
- SmiTypedGetterSetter.cs
- ClientScriptManager.cs
- ObjectHandle.cs
- WebPartMenu.cs
- TimeSpanMinutesConverter.cs
- HopperCache.cs
- SequenceDesigner.cs
- DataGridPagerStyle.cs
- XmlSchemaProviderAttribute.cs
- RegisteredExpandoAttribute.cs
- XmlWriter.cs
- DiscoveryReference.cs
- AssemblyNameProxy.cs
- ContextMenu.cs
- TemplateControl.cs