Code:
/ DotNET / DotNET / 8.0 / untmp / whidbey / REDBITS / 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(); } } }Specifies whether the switch is enabled /// ( ///) or disabled ( ).
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- CopyNamespacesAction.cs
- InputScopeManager.cs
- DataGridState.cs
- CursorEditor.cs
- ServiceHostingEnvironment.cs
- HostedTransportConfigurationManager.cs
- DataSysAttribute.cs
- InstalledFontCollection.cs
- DataServiceClientException.cs
- FileUtil.cs
- DataGridViewCellValueEventArgs.cs
- StringBuilder.cs
- DbDataAdapter.cs
- SqlInternalConnection.cs
- ThemeableAttribute.cs
- AsymmetricKeyExchangeFormatter.cs
- WebServiceResponse.cs
- SecondaryIndex.cs
- Helper.cs
- WindowsListBox.cs
- storagemappingitemcollection.viewdictionary.cs
- CompModSwitches.cs
- TextAutomationPeer.cs
- GZipStream.cs
- VariableDesigner.xaml.cs
- MasterPageParser.cs
- DiffuseMaterial.cs
- AsyncWaitHandle.cs
- DriveNotFoundException.cs
- DbConnectionPoolCounters.cs
- DecoderFallback.cs
- SystemIcmpV6Statistics.cs
- BuildProviderUtils.cs
- TableColumnCollection.cs
- ToolboxService.cs
- XmlArrayItemAttribute.cs
- EntityContainerEmitter.cs
- RayMeshGeometry3DHitTestResult.cs
- ColorConverter.cs
- ControlAdapter.cs
- BitmapEffectDrawingContent.cs
- Funcletizer.cs
- GridItemProviderWrapper.cs
- SchemaManager.cs
- NotifyParentPropertyAttribute.cs
- Types.cs
- SyntaxCheck.cs
- Keyboard.cs
- ListViewDeleteEventArgs.cs
- WebSysDisplayNameAttribute.cs
- WebRequestModuleElement.cs
- SqlAliasesReferenced.cs
- CompilerError.cs
- _HelperAsyncResults.cs
- DiagnosticsConfiguration.cs
- HitTestParameters.cs
- NameSpaceExtractor.cs
- XPathNodeHelper.cs
- TextEditorSelection.cs
- MappedMetaModel.cs
- CorrelationTokenInvalidatedHandler.cs
- AspNetSynchronizationContext.cs
- BinHexEncoding.cs
- DrawingImage.cs
- ForwardPositionQuery.cs
- PinProtectionHelper.cs
- SqlCacheDependencySection.cs
- AggregateNode.cs
- TextRunProperties.cs
- RangeValidator.cs
- RenderCapability.cs
- View.cs
- FocusWithinProperty.cs
- XmlSignificantWhitespace.cs
- Duration.cs
- ObjectDisposedException.cs
- ChineseLunisolarCalendar.cs
- SamlSerializer.cs
- DataFormats.cs
- DrawItemEvent.cs
- _HTTPDateParse.cs
- ToggleProviderWrapper.cs
- Int32Rect.cs
- TraceUtility.cs
- ListBox.cs
- IPAddress.cs
- TextEditorSelection.cs
- CheckPair.cs
- DataGridViewRowHeightInfoNeededEventArgs.cs
- RowToFieldTransformer.cs
- BamlWriter.cs
- EntityCollectionChangedParams.cs
- DeviceContext2.cs
- DependencyPropertyHelper.cs
- IdentityManager.cs
- CursorConverter.cs
- Propagator.ExtentPlaceholderCreator.cs
- IERequestCache.cs
- Image.cs
- Hex.cs