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
- InstanceDescriptor.cs
- Types.cs
- DataGridViewComboBoxColumn.cs
- CompilerResults.cs
- MeshGeometry3D.cs
- Attribute.cs
- PlatformCulture.cs
- TabPanel.cs
- ViewValidator.cs
- FixedTextContainer.cs
- XmlTextReaderImplHelpers.cs
- TextEditorSpelling.cs
- LinkArea.cs
- DataViewManager.cs
- ProcessRequestArgs.cs
- UnmanagedMemoryStreamWrapper.cs
- RightsManagementManager.cs
- GridViewRowCollection.cs
- TrustSection.cs
- ReferenceConverter.cs
- SQlBooleanStorage.cs
- ItemList.cs
- XamlVector3DCollectionSerializer.cs
- WinCategoryAttribute.cs
- SQLMoneyStorage.cs
- InvokeMethodActivity.cs
- Command.cs
- GridViewRowPresenter.cs
- Comparer.cs
- BufferedWebEventProvider.cs
- CodeDelegateCreateExpression.cs
- SymmetricAlgorithm.cs
- XmlCollation.cs
- tooltip.cs
- FixedSOMTableCell.cs
- InfoCardRSAPKCS1SignatureFormatter.cs
- AnimationTimeline.cs
- GeometryCombineModeValidation.cs
- RuntimeConfig.cs
- Emitter.cs
- BinaryKeyIdentifierClause.cs
- LiteralTextParser.cs
- WebPartTracker.cs
- BoolExpr.cs
- Trustee.cs
- XamlTypeMapper.cs
- EventProxy.cs
- BasicCellRelation.cs
- DiagnosticTraceSource.cs
- ADMembershipUser.cs
- SafeThreadHandle.cs
- ColorConvertedBitmap.cs
- ThousandthOfEmRealPoints.cs
- MemoryMappedViewStream.cs
- EntityDataSourceQueryBuilder.cs
- ColumnTypeConverter.cs
- ImageMetadata.cs
- GZipStream.cs
- AssemblyResourceLoader.cs
- XmlSchemaComplexContent.cs
- EventLogPermission.cs
- SelectionEditor.cs
- RTLAwareMessageBox.cs
- SerializationAttributes.cs
- ObjectMemberMapping.cs
- HotSpotCollection.cs
- Utility.cs
- TextTreeUndo.cs
- ResourceSetExpression.cs
- ValueTypeFixupInfo.cs
- DesignerCatalogPartChrome.cs
- CodeMemberProperty.cs
- PersonalizablePropertyEntry.cs
- XmlSchemaComplexContent.cs
- XmlAttributeCollection.cs
- ModelUIElement3D.cs
- DataBindingList.cs
- HtmlImageAdapter.cs
- NamedPipeChannelFactory.cs
- Opcode.cs
- ScriptingWebServicesSectionGroup.cs
- HashMembershipCondition.cs
- PeerCollaboration.cs
- MimeTypeMapper.cs
- TemplateComponentConnector.cs
- InProcStateClientManager.cs
- fixedPageContentExtractor.cs
- MemberAccessException.cs
- WebPartZoneBase.cs
- StylusPointCollection.cs
- CaseCqlBlock.cs
- TemplateGroupCollection.cs
- BindingValueChangedEventArgs.cs
- UnitySerializationHolder.cs
- InvokeGenerator.cs
- StyleBamlTreeBuilder.cs
- InkCanvas.cs
- WindowsIdentity.cs
- ImpersonationContext.cs
- ConfigXmlCDataSection.cs