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
- SQLBoolean.cs
- DocumentPageHost.cs
- PointCollection.cs
- TreeView.cs
- HttpWebRequestElement.cs
- DataGridCommandEventArgs.cs
- Style.cs
- ServiceBusyException.cs
- InstanceNotReadyException.cs
- SRef.cs
- PeerDuplexChannelListener.cs
- DbDataRecord.cs
- ComboBoxItem.cs
- OracleEncoding.cs
- SR.Designer.cs
- TokenBasedSetEnumerator.cs
- KeyTime.cs
- SecurityUtils.cs
- EncodingInfo.cs
- _ShellExpression.cs
- x509utils.cs
- MarkupCompilePass2.cs
- PoisonMessageException.cs
- BuildProvider.cs
- TraceContextEventArgs.cs
- UnsignedPublishLicense.cs
- UnicastIPAddressInformationCollection.cs
- XPathMultyIterator.cs
- XmlReaderDelegator.cs
- StyleConverter.cs
- NamedObject.cs
- SecUtil.cs
- SqlTriggerAttribute.cs
- CubicEase.cs
- HttpPostedFileWrapper.cs
- RowToParametersTransformer.cs
- NavigationProperty.cs
- AssemblyHash.cs
- DataGridViewColumnStateChangedEventArgs.cs
- SqlMethodCallConverter.cs
- StrokeCollection2.cs
- HttpUnhandledOperationInvoker.cs
- ListContractAdapter.cs
- FocusWithinProperty.cs
- CSharpCodeProvider.cs
- webclient.cs
- MarshalByRefObject.cs
- XmlAttributeOverrides.cs
- RequestCacheManager.cs
- ResourcePart.cs
- HGlobalSafeHandle.cs
- PropertyMetadata.cs
- XmlSchema.cs
- DiagnosticsConfiguration.cs
- _ListenerAsyncResult.cs
- ReliabilityContractAttribute.cs
- WebPartMenu.cs
- Section.cs
- RequestCachePolicyConverter.cs
- keycontainerpermission.cs
- RowToFieldTransformer.cs
- ParamArrayAttribute.cs
- HttpWrapper.cs
- ValidatorCompatibilityHelper.cs
- FileDialogCustomPlacesCollection.cs
- Timeline.cs
- WindowsMenu.cs
- SerializationObjectManager.cs
- StaticFileHandler.cs
- IsolatedStorageSecurityState.cs
- StatusBarItemAutomationPeer.cs
- DrawTreeNodeEventArgs.cs
- HtmlToClrEventProxy.cs
- PolyLineSegment.cs
- Config.cs
- AsymmetricKeyExchangeDeformatter.cs
- DBSchemaRow.cs
- TextDecorationLocationValidation.cs
- ObjectDataSourceMethodEventArgs.cs
- ListBox.cs
- TableAdapterManagerNameHandler.cs
- TagPrefixInfo.cs
- BaseParser.cs
- CommandBindingCollection.cs
- ToolStripCollectionEditor.cs
- Hashtable.cs
- AttributeCallbackBuilder.cs
- AppliesToBehaviorDecisionTable.cs
- StreamResourceInfo.cs
- WindowsListViewGroupSubsetLink.cs
- ComponentCollection.cs
- TimeSpanValidator.cs
- MethodExpr.cs
- exports.cs
- PropertySegmentSerializationProvider.cs
- IPAddress.cs
- DataGridViewAccessibleObject.cs
- XmlQueryType.cs
- StoreItemCollection.cs
- Utilities.cs