Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / whidbey / netfxsp / 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
- GradientStopCollection.cs
- FontStyle.cs
- StringAnimationUsingKeyFrames.cs
- MediaCommands.cs
- PropertyContainer.cs
- LingerOption.cs
- SerializationFieldInfo.cs
- SelectionEditor.cs
- ToolboxDataAttribute.cs
- mediaeventshelper.cs
- EnvironmentPermission.cs
- AttachmentCollection.cs
- MachineKeySection.cs
- ContextMenu.cs
- Popup.cs
- KnownTypeHelper.cs
- AccessViolationException.cs
- ScalarOps.cs
- BinaryObjectInfo.cs
- QilScopedVisitor.cs
- Calendar.cs
- GC.cs
- Header.cs
- DropShadowBitmapEffect.cs
- uribuilder.cs
- Variant.cs
- DefinitionUpdate.cs
- GenericEnumerator.cs
- SqlMethodAttribute.cs
- QilChoice.cs
- WaitHandle.cs
- RefreshEventArgs.cs
- NonParentingControl.cs
- DefaultBinder.cs
- ScaleTransform3D.cs
- InlinedAggregationOperatorEnumerator.cs
- LoginStatusDesigner.cs
- CalloutQueueItem.cs
- ByteStorage.cs
- XPathSelfQuery.cs
- ListControlBoundActionList.cs
- GenericXmlSecurityToken.cs
- DbMetaDataColumnNames.cs
- X509CertificateChain.cs
- SignalGate.cs
- _LocalDataStore.cs
- XsltSettings.cs
- mda.cs
- BitSet.cs
- InputReport.cs
- LogLogRecord.cs
- WmlLinkAdapter.cs
- Line.cs
- PageAsyncTaskManager.cs
- ToolboxDataAttribute.cs
- OpenFileDialog.cs
- BooleanAnimationBase.cs
- XmlFormatExtensionPointAttribute.cs
- StructuralComparisons.cs
- DataMemberFieldConverter.cs
- WbemException.cs
- AppDomainInfo.cs
- SqlWebEventProvider.cs
- DictionarySectionHandler.cs
- IncrementalCompileAnalyzer.cs
- Identity.cs
- _DigestClient.cs
- TrustManagerPromptUI.cs
- MatrixValueSerializer.cs
- MergeFailedEvent.cs
- UriParserTemplates.cs
- EncryptedData.cs
- PeerToPeerException.cs
- RowsCopiedEventArgs.cs
- CalendarDay.cs
- TagMapInfo.cs
- PartialCachingControl.cs
- PreloadedPackages.cs
- XPathArrayIterator.cs
- While.cs
- WindowsFormsSectionHandler.cs
- Error.cs
- InitializationEventAttribute.cs
- DataListDesigner.cs
- storagemappingitemcollection.viewdictionary.cs
- OuterGlowBitmapEffect.cs
- WorkflowDesignerColors.cs
- ScrollChangedEventArgs.cs
- MetadataCache.cs
- ProxyAttribute.cs
- SafeMILHandleMemoryPressure.cs
- LogicalMethodInfo.cs
- CustomErrorsSection.cs
- _HTTPDateParse.cs
- DataGridViewEditingControlShowingEventArgs.cs
- SqlDataSourceEnumerator.cs
- ScriptManager.cs
- XPathChildIterator.cs
- HttpCachePolicyWrapper.cs
- InputElement.cs