Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / CompMod / System / Diagnostics / BooleanSwitch.cs / 1305376 / 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
- Evidence.cs
- PrinterResolution.cs
- UnionExpr.cs
- SerialPort.cs
- XsltQilFactory.cs
- InputLangChangeRequestEvent.cs
- RightsManagementPermission.cs
- HttpWrapper.cs
- SQLDoubleStorage.cs
- PointConverter.cs
- TableAutomationPeer.cs
- CriticalFinalizerObject.cs
- EdmFunction.cs
- SafeProcessHandle.cs
- TargetControlTypeAttribute.cs
- HttpSessionStateBase.cs
- FactoryId.cs
- EmptyCollection.cs
- QilParameter.cs
- CollectionBase.cs
- EditorZoneBase.cs
- CodeAssignStatement.cs
- DnsElement.cs
- MobileControlsSectionHandler.cs
- SaveWorkflowCommand.cs
- ConditionedDesigner.cs
- OdbcFactory.cs
- DateTimeFormat.cs
- WebConfigurationHostFileChange.cs
- PocoEntityKeyStrategy.cs
- CurrentChangingEventArgs.cs
- NamespaceInfo.cs
- HierarchicalDataSourceIDConverter.cs
- EdmToObjectNamespaceMap.cs
- HttpResponseWrapper.cs
- Mutex.cs
- DynamicContractTypeBuilder.cs
- TextElementAutomationPeer.cs
- OleDbTransaction.cs
- XmlImplementation.cs
- OrCondition.cs
- DataContext.cs
- SimpleHandlerFactory.cs
- SoapHeaderException.cs
- OutputCacheSection.cs
- ClientBuildManager.cs
- HotSpotCollectionEditor.cs
- GCHandleCookieTable.cs
- SecurityTokenRequirement.cs
- DataListItemEventArgs.cs
- ThemeableAttribute.cs
- ImageMapEventArgs.cs
- LocalValueEnumerator.cs
- QueryResponse.cs
- WindowsFormsHostAutomationPeer.cs
- ActiveXContainer.cs
- AlignmentYValidation.cs
- RuntimeCompatibilityAttribute.cs
- NavigationProperty.cs
- NotFiniteNumberException.cs
- X509CertificateChain.cs
- StateWorkerRequest.cs
- SocketPermission.cs
- TextStore.cs
- ExtensionSimplifierMarkupObject.cs
- ApplicationInterop.cs
- StorageAssociationSetMapping.cs
- ServiceDescriptionData.cs
- ModuleBuilderData.cs
- OneOf.cs
- SoapInteropTypes.cs
- CatalogZoneBase.cs
- Vector3DConverter.cs
- XsdValidatingReader.cs
- DataGridViewColumnConverter.cs
- RectangleGeometry.cs
- AnyAllSearchOperator.cs
- RegexGroupCollection.cs
- ButtonRenderer.cs
- FloatUtil.cs
- DoubleMinMaxAggregationOperator.cs
- XmlSignatureManifest.cs
- WebPartMenu.cs
- EdmSchemaError.cs
- BufferModesCollection.cs
- TextTreeInsertElementUndoUnit.cs
- StorageScalarPropertyMapping.cs
- SqlBulkCopyColumnMapping.cs
- ReadOnlyCollection.cs
- DesignSurfaceServiceContainer.cs
- PeerNameRecord.cs
- MetadataSerializer.cs
- CatalogPartCollection.cs
- Matrix.cs
- AmbiguousMatchException.cs
- ListControl.cs
- TextStore.cs
- SiteIdentityPermission.cs
- RtfToXamlLexer.cs
- NativeMethodsCLR.cs