Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / whidbey / NetFXspW7 / 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
- QuaternionKeyFrameCollection.cs
- GeneralTransformCollection.cs
- ProgressChangedEventArgs.cs
- OptimizerPatterns.cs
- EmptyEnumerator.cs
- CrossContextChannel.cs
- DoubleAnimationUsingPath.cs
- SqlClientWrapperSmiStream.cs
- IDReferencePropertyAttribute.cs
- SqlMultiplexer.cs
- SystemDiagnosticsSection.cs
- WinFormsSpinner.cs
- RefType.cs
- SkewTransform.cs
- MemberCollection.cs
- HandlerBase.cs
- SerialPort.cs
- XmlDataCollection.cs
- StretchValidation.cs
- ThicknessConverter.cs
- DocumentPageTextView.cs
- _LazyAsyncResult.cs
- InheritanceContextChangedEventManager.cs
- PersistChildrenAttribute.cs
- XmlImplementation.cs
- CapiHashAlgorithm.cs
- GenericAuthenticationEventArgs.cs
- RijndaelManagedTransform.cs
- TextCompositionManager.cs
- LinkArea.cs
- __Filters.cs
- ValidatorUtils.cs
- SupportingTokenAuthenticatorSpecification.cs
- NetMsmqBindingElement.cs
- UnsafeNativeMethods.cs
- TaskCanceledException.cs
- DocumentXmlWriter.cs
- CustomGrammar.cs
- ConnectionOrientedTransportChannelFactory.cs
- SoapObjectInfo.cs
- TableMethodGenerator.cs
- SHA512.cs
- CachedCompositeFamily.cs
- FactoryRecord.cs
- FreeIndexList.cs
- EntityReference.cs
- MappingItemCollection.cs
- BufferedReceiveElement.cs
- FileUpload.cs
- DataObjectMethodAttribute.cs
- WSFederationHttpSecurity.cs
- ChildTable.cs
- SafeLocalAllocation.cs
- ByteStreamMessage.cs
- PageResolution.cs
- InvalidProgramException.cs
- PointConverter.cs
- StreamGeometryContext.cs
- WebPartDeleteVerb.cs
- DataControlCommands.cs
- BamlRecordWriter.cs
- WebPartVerb.cs
- MethodBuilder.cs
- StandardBindingElement.cs
- DataGridToolTip.cs
- FormsAuthenticationCredentials.cs
- SingleAnimation.cs
- IntegerValidator.cs
- DependencyObjectPropertyDescriptor.cs
- ExceptQueryOperator.cs
- CapabilitiesUse.cs
- WebPartZone.cs
- StylusButtonEventArgs.cs
- PreservationFileWriter.cs
- GlobalizationSection.cs
- ExpanderAutomationPeer.cs
- Utils.cs
- XmlNodeReader.cs
- NullRuntimeConfig.cs
- UserPreferenceChangingEventArgs.cs
- Stacktrace.cs
- ApplicationGesture.cs
- XmlStreamNodeWriter.cs
- TextDecorationCollection.cs
- PublisherIdentityPermission.cs
- PageParserFilter.cs
- DiscoveryClientChannelFactory.cs
- FormsAuthenticationEventArgs.cs
- PackageDigitalSignatureManager.cs
- TemplateBindingExtension.cs
- MaterialCollection.cs
- InputBindingCollection.cs
- DebugHandleTracker.cs
- ApplicationBuildProvider.cs
- SqlDataSourceFilteringEventArgs.cs
- TripleDESCryptoServiceProvider.cs
- TextBox.cs
- Propagator.JoinPropagator.JoinPredicateVisitor.cs
- Axis.cs
- PageThemeCodeDomTreeGenerator.cs