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
- HwndSourceKeyboardInputSite.cs
- AlphaSortedEnumConverter.cs
- Slider.cs
- TargetInvocationException.cs
- ListBoxItemWrapperAutomationPeer.cs
- DomainUpDown.cs
- DesignUtil.cs
- GlyphRunDrawing.cs
- BehaviorDragDropEventArgs.cs
- FileLoadException.cs
- CreateRefExpr.cs
- DataFormats.cs
- DataObject.cs
- VariantWrapper.cs
- CqlIdentifiers.cs
- CodeDomDesignerLoader.cs
- MachinePropertyVariants.cs
- XmlArrayItemAttributes.cs
- RightsManagementEncryptionTransform.cs
- PropertyPathConverter.cs
- WindowsRebar.cs
- HtmlPanelAdapter.cs
- ClickablePoint.cs
- RectAnimationUsingKeyFrames.cs
- WebEventTraceProvider.cs
- DataGridView.cs
- xsdvalidator.cs
- SerialReceived.cs
- MethodInfo.cs
- WorkItem.cs
- AttachedPropertyMethodSelector.cs
- ObjRef.cs
- XmlName.cs
- HtmlMeta.cs
- KeyNameIdentifierClause.cs
- WindowCollection.cs
- XmlUrlEditor.cs
- AccessibilityHelperForVista.cs
- BufferModeSettings.cs
- GeometryCollection.cs
- XmlLoader.cs
- Socket.cs
- Method.cs
- Quaternion.cs
- ForeignKeyFactory.cs
- WebServiceErrorEvent.cs
- EqualityComparer.cs
- FontUnitConverter.cs
- IsolatedStorageSecurityState.cs
- StateManagedCollection.cs
- AddInEnvironment.cs
- DispatcherEventArgs.cs
- XmlValueConverter.cs
- SafeFileHandle.cs
- RefExpr.cs
- IisTraceListener.cs
- DataServiceProviderWrapper.cs
- WeakReferenceEnumerator.cs
- DupHandleConnectionReader.cs
- JournalNavigationScope.cs
- XpsFontSerializationService.cs
- UrlMappingCollection.cs
- PropertyDescriptorGridEntry.cs
- LockedBorderGlyph.cs
- DrawTreeNodeEventArgs.cs
- X509ClientCertificateAuthentication.cs
- ValueExpressions.cs
- SoapElementAttribute.cs
- xmlglyphRunInfo.cs
- TraceEventCache.cs
- GrammarBuilderBase.cs
- DNS.cs
- StringCollection.cs
- ToolStripOverflowButton.cs
- TimeoutValidationAttribute.cs
- StorageScalarPropertyMapping.cs
- BitStack.cs
- PreservationFileReader.cs
- ConfigurationSectionGroupCollection.cs
- ParserContext.cs
- ToolboxComponentsCreatedEventArgs.cs
- BitmapEffectInput.cs
- XmlName.cs
- DataFormats.cs
- RegistryKey.cs
- EntityStoreSchemaFilterEntry.cs
- NullableBoolConverter.cs
- CellTreeNode.cs
- VirtualizedItemProviderWrapper.cs
- ActiveDesignSurfaceEvent.cs
- ScriptControlManager.cs
- OracleConnectionStringBuilder.cs
- ScrollBar.cs
- BamlRecords.cs
- DbConnectionHelper.cs
- QilPatternFactory.cs
- Expression.cs
- FontCacheLogic.cs
- TokenBasedSet.cs
- AddInActivator.cs