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
- RadioButtonFlatAdapter.cs
- WebPartManagerDesigner.cs
- PointAnimationBase.cs
- SqlDataSourceQueryEditor.cs
- SelectionEditingBehavior.cs
- CacheDependency.cs
- Walker.cs
- ModuleElement.cs
- ZoneIdentityPermission.cs
- OrderByQueryOptionExpression.cs
- DataGridParentRows.cs
- PropertyChangedEventManager.cs
- InputBinding.cs
- ArrayExtension.cs
- InitializingNewItemEventArgs.cs
- XsltQilFactory.cs
- RegexCaptureCollection.cs
- SponsorHelper.cs
- Object.cs
- Journal.cs
- DBConnectionString.cs
- EventBuilder.cs
- ProfileServiceManager.cs
- RemotingSurrogateSelector.cs
- XsltQilFactory.cs
- PerfCounters.cs
- XmlDataSourceView.cs
- BindingBase.cs
- IPAddressCollection.cs
- StyleXamlParser.cs
- ExpressionContext.cs
- CompositeFontFamily.cs
- URLMembershipCondition.cs
- FontCacheLogic.cs
- Renderer.cs
- VScrollBar.cs
- TextTreeTextElementNode.cs
- httpserverutility.cs
- WorkflowFileItem.cs
- DebuggerAttributes.cs
- SuppressMessageAttribute.cs
- Reference.cs
- SqlWriter.cs
- CheckableControlBaseAdapter.cs
- ProtectedProviderSettings.cs
- CmsInterop.cs
- ItemChangedEventArgs.cs
- ResolveMatchesCD1.cs
- StorageMappingItemLoader.cs
- Empty.cs
- Label.cs
- ADRole.cs
- XPathNodeIterator.cs
- DataListCommandEventArgs.cs
- Random.cs
- EncoderBestFitFallback.cs
- CodeSnippetStatement.cs
- newinstructionaction.cs
- WorkflowPageSetupDialog.cs
- SafeFindHandle.cs
- dbenumerator.cs
- DecoderFallbackWithFailureFlag.cs
- WebPartDisplayModeCancelEventArgs.cs
- StreamUpgradeInitiator.cs
- TypeSystem.cs
- ToolStripPanelRow.cs
- InternalConfigSettingsFactory.cs
- WebPartRestoreVerb.cs
- HttpProfileGroupBase.cs
- EventItfInfo.cs
- AsymmetricAlgorithm.cs
- itemelement.cs
- MasterPageCodeDomTreeGenerator.cs
- ActionFrame.cs
- TouchesOverProperty.cs
- MetaTable.cs
- EventProxy.cs
- Quaternion.cs
- SchemaImporterExtensionsSection.cs
- XmlAttributes.cs
- ChannelEndpointElementCollection.cs
- SizeAnimationClockResource.cs
- ProtectedConfiguration.cs
- AdornedElementPlaceholder.cs
- AliasedSlot.cs
- ChildrenQuery.cs
- LiteralSubsegment.cs
- ColorInterpolationModeValidation.cs
- XmlUrlResolver.cs
- EpmSyndicationContentSerializer.cs
- HtmlUtf8RawTextWriter.cs
- Guid.cs
- SafePointer.cs
- FontSourceCollection.cs
- ClientConvert.cs
- TreeWalker.cs
- ImageInfo.cs
- AuthenticateEventArgs.cs
- BatchParser.cs
- WebPartAuthorizationEventArgs.cs