Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / CompMod / System / Diagnostics / BooleanSwitch.cs / 1305376 / 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
- UrlAuthorizationModule.cs
- WebPartDisplayMode.cs
- MetricEntry.cs
- StrongNameIdentityPermission.cs
- FixedTextSelectionProcessor.cs
- HelloMessageCD1.cs
- OletxCommittableTransaction.cs
- WebPartRestoreVerb.cs
- WorkflowFormatterBehavior.cs
- COAUTHINFO.cs
- FieldMetadata.cs
- StylusPointCollection.cs
- ToolStripStatusLabel.cs
- ApplicationFileParser.cs
- OleDbReferenceCollection.cs
- Activity.cs
- ObjectFactoryCodeDomTreeGenerator.cs
- objectresult_tresulttype.cs
- ArrayWithOffset.cs
- BmpBitmapDecoder.cs
- XPathQueryGenerator.cs
- DataObjectMethodAttribute.cs
- SelectionRange.cs
- login.cs
- CursorConverter.cs
- FontNameEditor.cs
- EdmToObjectNamespaceMap.cs
- ServicesUtilities.cs
- ZipIOExtraField.cs
- TextSchema.cs
- BufferedGraphicsContext.cs
- TransformProviderWrapper.cs
- Int16.cs
- AudienceUriMode.cs
- ResourceDescriptionAttribute.cs
- DbProviderFactory.cs
- EntityDataSourceStatementEditor.cs
- OracleLob.cs
- ScrollEventArgs.cs
- LeftCellWrapper.cs
- Highlights.cs
- RuleSettingsCollection.cs
- LogFlushAsyncResult.cs
- AttachedPropertyBrowsableWhenAttributePresentAttribute.cs
- SaveFileDialog.cs
- PermissionSetEnumerator.cs
- XmlQueryRuntime.cs
- SpeakProgressEventArgs.cs
- ExpressionBuilder.cs
- TcpClientSocketManager.cs
- MenuAutoFormat.cs
- RegisteredHiddenField.cs
- Missing.cs
- WinFormsComponentEditor.cs
- SecUtil.cs
- BlockExpression.cs
- HttpProxyCredentialType.cs
- TagMapCollection.cs
- ResXResourceWriter.cs
- CompilerErrorCollection.cs
- HttpProfileGroupBase.cs
- FormViewActionList.cs
- HierarchicalDataBoundControl.cs
- InstanceData.cs
- PropertyDescriptor.cs
- XmlSchemaSimpleContent.cs
- SoundPlayer.cs
- DataRecord.cs
- MonthCalendar.cs
- LassoHelper.cs
- ErrorHandler.cs
- ProcessHostConfigUtils.cs
- IPGlobalProperties.cs
- ExtensibleClassFactory.cs
- ScriptRef.cs
- GenericIdentity.cs
- EncoderExceptionFallback.cs
- BaseResourcesBuildProvider.cs
- CounterCreationData.cs
- ToolStripProgressBar.cs
- DoubleAnimationBase.cs
- ProgressChangedEventArgs.cs
- Timeline.cs
- HelloMessage11.cs
- DbDataReader.cs
- PriorityQueue.cs
- VectorKeyFrameCollection.cs
- _SpnDictionary.cs
- WmlFormAdapter.cs
- MetadataCache.cs
- CorruptingExceptionCommon.cs
- DataColumn.cs
- _IPv4Address.cs
- ObjectCache.cs
- SpellCheck.cs
- TypedReference.cs
- PartialCachingControl.cs
- MobileComponentEditorPage.cs
- GuidelineCollection.cs
- DateTimeFormatInfoScanner.cs