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
- Resources.Designer.cs
- Expression.cs
- UncommonField.cs
- COM2ColorConverter.cs
- NameObjectCollectionBase.cs
- ContractComponent.cs
- EmbeddedMailObjectCollectionEditor.cs
- RootProfilePropertySettingsCollection.cs
- IdentitySection.cs
- EncodingNLS.cs
- EntitySqlQueryState.cs
- LogLogRecordEnumerator.cs
- OperationValidationEventArgs.cs
- DataException.cs
- ObjectComplexPropertyMapping.cs
- MenuItemBindingCollection.cs
- SoapCodeExporter.cs
- HuffmanTree.cs
- WindowsAuthenticationModule.cs
- Int64KeyFrameCollection.cs
- ToolStripItemRenderEventArgs.cs
- ExpandCollapsePattern.cs
- CommandBinding.cs
- RelatedCurrencyManager.cs
- ListSourceHelper.cs
- CollectionViewGroupRoot.cs
- CryptoProvider.cs
- ReceiveContextCollection.cs
- TreeSet.cs
- CatalogPartChrome.cs
- Link.cs
- ProcessProtocolHandler.cs
- WindowsTab.cs
- DataBoundControlActionList.cs
- _TLSstream.cs
- CopyEncoder.cs
- QilStrConcat.cs
- StateManagedCollection.cs
- TemplatedEditableDesignerRegion.cs
- SqlFileStream.cs
- XmlSerializableServices.cs
- Subtract.cs
- CopyEncoder.cs
- ContextStaticAttribute.cs
- EventLogPermissionAttribute.cs
- ConfigXmlSignificantWhitespace.cs
- DataBindingsDialog.cs
- BamlTreeUpdater.cs
- CounterSampleCalculator.cs
- XmlSerializerVersionAttribute.cs
- PathParser.cs
- CheckBoxField.cs
- ConnectionsZone.cs
- SizeFConverter.cs
- SecureConversationServiceCredential.cs
- Int64Storage.cs
- SystemIPInterfaceStatistics.cs
- PropertyRecord.cs
- XmlCharCheckingReader.cs
- CachedBitmap.cs
- oledbconnectionstring.cs
- CorrelationHandle.cs
- Native.cs
- WeakHashtable.cs
- SymbolPair.cs
- DataTableTypeConverter.cs
- FileVersion.cs
- ToolStripContainerActionList.cs
- HitTestParameters.cs
- TextBoxAutoCompleteSourceConverter.cs
- MemoryMappedViewAccessor.cs
- HttpProfileGroupBase.cs
- CacheRequest.cs
- TextParagraphProperties.cs
- SafeRightsManagementHandle.cs
- Rules.cs
- DurationConverter.cs
- OutputWindow.cs
- hwndwrapper.cs
- DataBindEngine.cs
- ComplexTypeEmitter.cs
- DataFormats.cs
- GradientBrush.cs
- EntityTransaction.cs
- _NegotiateClient.cs
- ValidatedControlConverter.cs
- SqlDataAdapter.cs
- ImplicitInputBrush.cs
- Environment.cs
- WsatTransactionInfo.cs
- FilteredSchemaElementLookUpTable.cs
- ManagedFilter.cs
- KernelTypeValidation.cs
- RoleBoolean.cs
- ClaimSet.cs
- DataGridViewCellStyle.cs
- NonBatchDirectoryCompiler.cs
- OneWayChannelListener.cs
- DataSysAttribute.cs
- BrowserCapabilitiesFactory.cs