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
- ColumnMapTranslator.cs
- AuthorizationRule.cs
- MailDefinitionBodyFileNameEditor.cs
- SharedUtils.cs
- TraceContext.cs
- SingleObjectCollection.cs
- TextSimpleMarkerProperties.cs
- DescendentsWalker.cs
- WebPartMenuStyle.cs
- OutgoingWebRequestContext.cs
- ViewBase.cs
- cache.cs
- PathSegment.cs
- RubberbandSelector.cs
- Select.cs
- CacheChildrenQuery.cs
- CharacterString.cs
- WorkItem.cs
- RadioButtonPopupAdapter.cs
- PageFunction.cs
- Effect.cs
- Wizard.cs
- ResourcesChangeInfo.cs
- NewExpression.cs
- CacheVirtualItemsEvent.cs
- MailMessageEventArgs.cs
- RuleSetReference.cs
- DecoderExceptionFallback.cs
- Models.cs
- DataControlFieldCell.cs
- FunctionQuery.cs
- CodeArgumentReferenceExpression.cs
- Predicate.cs
- ReaderContextStackData.cs
- PropertyPathConverter.cs
- AcceleratedTokenProvider.cs
- ElementProxy.cs
- SoapSchemaExporter.cs
- ManagementException.cs
- WebBrowser.cs
- ReadOnlyTernaryTree.cs
- Knowncolors.cs
- ByteAnimation.cs
- SoapExtensionImporter.cs
- XmlNamedNodeMap.cs
- Currency.cs
- PackUriHelper.cs
- XPathItem.cs
- RectConverter.cs
- NotCondition.cs
- EntityAdapter.cs
- StackBuilderSink.cs
- ReceiveActivityValidator.cs
- LayoutManager.cs
- sitestring.cs
- Rect3DValueSerializer.cs
- DesignerObject.cs
- SqlDataSourceCommandEventArgs.cs
- DataGridGeneralPage.cs
- AppearanceEditorPart.cs
- HandlerFactoryCache.cs
- CompiledRegexRunnerFactory.cs
- DBCSCodePageEncoding.cs
- ClassValidator.cs
- CryptoKeySecurity.cs
- ConfigurationStrings.cs
- MsmqIntegrationProcessProtocolHandler.cs
- XmlILModule.cs
- RepeaterItemEventArgs.cs
- WindowsGrip.cs
- BaseTemplateCodeDomTreeGenerator.cs
- XmlNotation.cs
- HttpRuntimeSection.cs
- _CookieModule.cs
- PortCache.cs
- SHA1CryptoServiceProvider.cs
- DeploymentSection.cs
- MemoryMappedView.cs
- LockCookie.cs
- DataGridColumnHeaderCollection.cs
- AggregateNode.cs
- CryptographicAttribute.cs
- ToolStripItem.cs
- WindowsBrush.cs
- SqlXml.cs
- ConnectionManagementElement.cs
- DataBinder.cs
- XsltException.cs
- ObjectListTitleAttribute.cs
- CatalogUtil.cs
- ExpressionBuilderCollection.cs
- DataGridItemAutomationPeer.cs
- XmlNamespaceDeclarationsAttribute.cs
- XmlSchemaExternal.cs
- IUnknownConstantAttribute.cs
- ChannelOptions.cs
- Timer.cs
- XmlAnyElementAttribute.cs
- GridItem.cs
- FixedSOMSemanticBox.cs