Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / whidbey / NetFXspW7 / 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
- ObjectListFieldsPage.cs
- Constants.cs
- IsolationInterop.cs
- BindingExpressionUncommonField.cs
- CodeLabeledStatement.cs
- SelectionProviderWrapper.cs
- ScrollChrome.cs
- CSharpCodeProvider.cs
- InteropAutomationProvider.cs
- BindingValueChangedEventArgs.cs
- CoreSwitches.cs
- XmlSchemaDocumentation.cs
- ReadContentAsBinaryHelper.cs
- EntryIndex.cs
- Internal.cs
- TextChangedEventArgs.cs
- ChangeBlockUndoRecord.cs
- SinglePhaseEnlistment.cs
- SiteMapSection.cs
- Double.cs
- XmlSchema.cs
- CodeDesigner.cs
- AvTraceDetails.cs
- LinkClickEvent.cs
- ReaderContextStackData.cs
- Visitor.cs
- DoubleCollectionConverter.cs
- BasicCellRelation.cs
- ToolStripSeparator.cs
- MethodSignatureGenerator.cs
- CriticalExceptions.cs
- AdornerPresentationContext.cs
- FontCacheLogic.cs
- IntegerValidatorAttribute.cs
- ExpressionBuilderContext.cs
- WebConfigurationManager.cs
- Documentation.cs
- PublisherMembershipCondition.cs
- SqlTransaction.cs
- Pool.cs
- ColumnWidthChangingEvent.cs
- WebPartDescription.cs
- BitmapMetadataEnumerator.cs
- AdornedElementPlaceholder.cs
- SpanIndex.cs
- TreeNodeMouseHoverEvent.cs
- ItemPager.cs
- DynamicField.cs
- OutOfProcStateClientManager.cs
- FileCodeGroup.cs
- RangeValueProviderWrapper.cs
- ApplicationSecurityManager.cs
- AsymmetricSignatureDeformatter.cs
- SafeEventLogReadHandle.cs
- AddValidationError.cs
- RC2CryptoServiceProvider.cs
- ProviderConnectionPointCollection.cs
- EpmCustomContentDeSerializer.cs
- HttpCapabilitiesBase.cs
- FileClassifier.cs
- SQLMembershipProvider.cs
- MatrixTransform.cs
- KeyConverter.cs
- DetailsViewInsertedEventArgs.cs
- DecimalAnimationUsingKeyFrames.cs
- DispatchWrapper.cs
- NullableLongMinMaxAggregationOperator.cs
- RenamedEventArgs.cs
- JsonReader.cs
- ToolStripSettings.cs
- EffectiveValueEntry.cs
- XmlEntity.cs
- ProbeMatchesMessageCD1.cs
- EventSourceCreationData.cs
- SubtreeProcessor.cs
- WCFModelStrings.Designer.cs
- Event.cs
- SchemaElement.cs
- BidPrivateBase.cs
- HttpProcessUtility.cs
- HelloOperationCD1AsyncResult.cs
- NullToBooleanConverter.cs
- ColumnResizeAdorner.cs
- ReadOnlyCollectionBase.cs
- Error.cs
- PageOutputQuality.cs
- PropertyStore.cs
- RunInstallerAttribute.cs
- SR.cs
- FixedPageAutomationPeer.cs
- SimpleMailWebEventProvider.cs
- LocalizabilityAttribute.cs
- SQLMoneyStorage.cs
- CompositionAdorner.cs
- ActivityDesignerAccessibleObject.cs
- TabControl.cs
- StringFormat.cs
- DefaultEvaluationContext.cs
- SystemIPv4InterfaceProperties.cs
- codemethodreferenceexpression.cs