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
- InkCollectionBehavior.cs
- BinHexDecoder.cs
- DataSysAttribute.cs
- DesigntimeLicenseContext.cs
- References.cs
- MsmqIntegrationSecurityMode.cs
- ImageListStreamer.cs
- TreeNodeStyleCollection.cs
- PermissionRequestEvidence.cs
- SqlProviderManifest.cs
- SchemaCollectionPreprocessor.cs
- Interfaces.cs
- GrammarBuilderBase.cs
- TableAdapterManagerNameHandler.cs
- ADMembershipUser.cs
- FontStretchConverter.cs
- EventLogPermission.cs
- OdbcConnectionStringbuilder.cs
- LockRenewalTask.cs
- CodeCommentStatementCollection.cs
- _DomainName.cs
- Stacktrace.cs
- FontNameConverter.cs
- DataTableReaderListener.cs
- WinInetCache.cs
- SelectedCellsCollection.cs
- CompositeKey.cs
- ErrorRuntimeConfig.cs
- XmlSchemaInclude.cs
- ProfileServiceManager.cs
- PageThemeBuildProvider.cs
- UnsafeNativeMethods.cs
- DetailsViewRowCollection.cs
- TextRenderer.cs
- MailHeaderInfo.cs
- NoneExcludedImageIndexConverter.cs
- TypeConverterHelper.cs
- ObservableDictionary.cs
- Int64Storage.cs
- assemblycache.cs
- XmlRootAttribute.cs
- MethodBody.cs
- InvalidateEvent.cs
- TargetParameterCountException.cs
- WinEventTracker.cs
- SplitterCancelEvent.cs
- MemberInfoSerializationHolder.cs
- BindingCompleteEventArgs.cs
- ListViewDataItem.cs
- QueryContinueDragEventArgs.cs
- HandlerFactoryWrapper.cs
- ConnectionManagementElementCollection.cs
- GeneralTransform3DGroup.cs
- DataContractSerializerServiceBehavior.cs
- RegexWriter.cs
- AttributeEmitter.cs
- DataGridItem.cs
- CodeDirectoryCompiler.cs
- DataGridItemCollection.cs
- BooleanFunctions.cs
- ErrorFormatter.cs
- Expander.cs
- AttributeParameterInfo.cs
- TextBoxAutoCompleteSourceConverter.cs
- IntPtr.cs
- MatrixTransform.cs
- StreamAsIStream.cs
- SecurityTokenParameters.cs
- MachineSettingsSection.cs
- QueryableDataSourceView.cs
- DataPagerFieldCommandEventArgs.cs
- DBCSCodePageEncoding.cs
- TypeConverterHelper.cs
- BuilderElements.cs
- CellConstant.cs
- WebControl.cs
- OracleRowUpdatingEventArgs.cs
- LineServicesRun.cs
- DataGridViewAutoSizeModeEventArgs.cs
- GB18030Encoding.cs
- TypeDescriptionProviderAttribute.cs
- SynchronousChannelMergeEnumerator.cs
- AlphaSortedEnumConverter.cs
- AbandonedMutexException.cs
- ZipFileInfoCollection.cs
- ColorConvertedBitmap.cs
- ValidationHelpers.cs
- PropertyBuilder.cs
- SafeNativeMethods.cs
- ModulesEntry.cs
- XmlSchemaChoice.cs
- StorageRoot.cs
- FlowStep.cs
- ServiceRouteHandler.cs
- OperationCanceledException.cs
- CodeConditionStatement.cs
- SpeechRecognizer.cs
- SpellerHighlightLayer.cs
- ProgressChangedEventArgs.cs
- sqlmetadatafactory.cs