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
- ByteStreamMessageEncoderFactory.cs
- DbProviderFactoriesConfigurationHandler.cs
- Size3DConverter.cs
- MaterializeFromAtom.cs
- XmlDataFileEditor.cs
- EntityDesignerUtils.cs
- HiddenFieldPageStatePersister.cs
- StringValidatorAttribute.cs
- ListView.cs
- DeclarativeCatalogPart.cs
- Matrix3DValueSerializer.cs
- IsolatedStorageFileStream.cs
- RegexCompilationInfo.cs
- PackageDigitalSignature.cs
- _NegoState.cs
- XmlSchemaInferenceException.cs
- RootNamespaceAttribute.cs
- OutputCacheSection.cs
- RelationHandler.cs
- SslStreamSecurityElement.cs
- LogExtentCollection.cs
- versioninfo.cs
- CodeTypeMember.cs
- SelectionHighlightInfo.cs
- DocumentApplication.cs
- ServicePointManager.cs
- ProxyWebPart.cs
- GridViewCellAutomationPeer.cs
- DataGridViewCellCancelEventArgs.cs
- TemplateKey.cs
- RotateTransform.cs
- DiscoveryViaBehavior.cs
- NavigationService.cs
- ValidatorCollection.cs
- EndpointFilterProvider.cs
- EditingMode.cs
- PenThreadWorker.cs
- CommonServiceBehaviorElement.cs
- EditBehavior.cs
- IssuedTokenParametersElement.cs
- ShellProvider.cs
- FactoryGenerator.cs
- CoTaskMemHandle.cs
- SystemIPInterfaceStatistics.cs
- SQLBoolean.cs
- OptionalMessageQuery.cs
- ZipPackagePart.cs
- RegexWorker.cs
- InstanceValue.cs
- XmlHelper.cs
- RadioButtonStandardAdapter.cs
- SqlDataSourceQueryConverter.cs
- Italic.cs
- ComponentFactoryHelpers.cs
- LambdaSerializationException.cs
- panel.cs
- FrugalList.cs
- mda.cs
- ISAPIWorkerRequest.cs
- SiteMapHierarchicalDataSourceView.cs
- DataServiceHost.cs
- TrackingCondition.cs
- SmiContextFactory.cs
- SHA512.cs
- ColorConvertedBitmap.cs
- TemplatePagerField.cs
- AddIn.cs
- __FastResourceComparer.cs
- IndentedWriter.cs
- InstancePersistenceContext.cs
- SqlClientMetaDataCollectionNames.cs
- Utils.cs
- DispatcherExceptionEventArgs.cs
- PermissionListSet.cs
- PagedDataSource.cs
- EnumValidator.cs
- HtmlTableRowCollection.cs
- BrowserCapabilitiesFactoryBase.cs
- DrawingGroup.cs
- WebPartConnectVerb.cs
- ImageList.cs
- PerformanceCounterManager.cs
- ImageCodecInfoPrivate.cs
- ValidationHelper.cs
- Compensation.cs
- Message.cs
- TextTabProperties.cs
- TransformerInfoCollection.cs
- Point3DConverter.cs
- FullTextBreakpoint.cs
- AmbientLight.cs
- RenderContext.cs
- IntSecurity.cs
- WSSecureConversation.cs
- TemplateNameScope.cs
- Queue.cs
- AppearanceEditorPart.cs
- XmlSchemaSimpleTypeRestriction.cs
- DefaultSettingsSection.cs
- ExpressionVisitor.cs