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
- CompiledQueryCacheKey.cs
- NoPersistProperty.cs
- UnsafeNativeMethods.cs
- HandlerMappingMemo.cs
- PopupEventArgs.cs
- ClientSettingsStore.cs
- ConfigurationErrorsException.cs
- Number.cs
- RegexCapture.cs
- LogEntrySerialization.cs
- HtmlInputReset.cs
- TextRenderingModeValidation.cs
- ToolStripLocationCancelEventArgs.cs
- ErrorEventArgs.cs
- WasAdminWrapper.cs
- SessionStateContainer.cs
- LambdaCompiler.Lambda.cs
- KoreanLunisolarCalendar.cs
- GeneralTransform3D.cs
- RemotingException.cs
- ConnectionInterfaceCollection.cs
- OracleBoolean.cs
- URL.cs
- XmlUTF8TextWriter.cs
- Version.cs
- RemotingConfiguration.cs
- PassportPrincipal.cs
- CacheSection.cs
- CreateCardRequest.cs
- PartitionResolver.cs
- __Filters.cs
- RegionData.cs
- LinearGradientBrush.cs
- DSGeneratorProblem.cs
- SqlTypeSystemProvider.cs
- StringConverter.cs
- DynamicMetaObjectBinder.cs
- LocalBuilder.cs
- ToolStripSplitButton.cs
- ProjectionQueryOptionExpression.cs
- XPathDocumentNavigator.cs
- DiscoveryVersion.cs
- LayoutEngine.cs
- CopyAction.cs
- TreeNodeClickEventArgs.cs
- VScrollProperties.cs
- ClientFormsAuthenticationCredentials.cs
- QueryStoreStatusRequest.cs
- DocumentCollection.cs
- DataPagerFieldItem.cs
- FolderBrowserDialog.cs
- HttpDigestClientElement.cs
- ListViewSelectEventArgs.cs
- ImmutableAssemblyCacheEntry.cs
- RenderDataDrawingContext.cs
- AnnotationHelper.cs
- BrowserTree.cs
- Style.cs
- NumericUpDownAcceleration.cs
- PageRanges.cs
- RangeValuePatternIdentifiers.cs
- TextureBrush.cs
- PersistenceException.cs
- QueueProcessor.cs
- MultiView.cs
- GridViewColumnCollection.cs
- XmlSerializerSection.cs
- InputManager.cs
- ColumnMapVisitor.cs
- EntityType.cs
- xmlfixedPageInfo.cs
- SrgsRuleRef.cs
- TreeIterator.cs
- KnowledgeBase.cs
- RenderingBiasValidation.cs
- GrammarBuilderDictation.cs
- SqlProviderUtilities.cs
- LocationUpdates.cs
- EntityFunctions.cs
- RequestCacheValidator.cs
- XmlSerializerSection.cs
- AvtEvent.cs
- UiaCoreProviderApi.cs
- InkCanvasAutomationPeer.cs
- ToolStripItemCollection.cs
- ProvideValueServiceProvider.cs
- _StreamFramer.cs
- _ProxyChain.cs
- DisplayInformation.cs
- OSFeature.cs
- DynamicDataManager.cs
- XmlWriterTraceListener.cs
- WebPartZoneAutoFormat.cs
- InputBuffer.cs
- DateTimePicker.cs
- GridViewCellAutomationPeer.cs
- InternalRelationshipCollection.cs
- TreeNodeBindingCollection.cs
- ImageIndexConverter.cs
- WebPartVerbCollection.cs