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
- WebResponse.cs
- ConfigurationManagerInternalFactory.cs
- FileLoadException.cs
- ReservationCollection.cs
- XmlSerializerNamespaces.cs
- ComponentEditorForm.cs
- IPAddressCollection.cs
- TemplateAction.cs
- CommandBinding.cs
- DBBindings.cs
- ControlAdapter.cs
- CompilerState.cs
- Propagator.Evaluator.cs
- ResponseBodyWriter.cs
- PerformanceCounterPermissionEntry.cs
- WinFormsUtils.cs
- ButtonField.cs
- HtmlControl.cs
- HostingMessageProperty.cs
- DrawItemEvent.cs
- QueryContinueDragEventArgs.cs
- CompilerGeneratedAttribute.cs
- ValueUnavailableException.cs
- LogEntrySerialization.cs
- CodeIdentifier.cs
- NavigationFailedEventArgs.cs
- UriSchemeKeyedCollection.cs
- Mouse.cs
- TiffBitmapDecoder.cs
- StringSource.cs
- HttpServerVarsCollection.cs
- PrePostDescendentsWalker.cs
- StateDesigner.Helpers.cs
- PerformanceCounterPermissionEntryCollection.cs
- NativeMethodsCLR.cs
- Helpers.cs
- ExtenderControl.cs
- PriorityQueue.cs
- RegistryKey.cs
- DataGridRowsPresenter.cs
- HttpHostedTransportConfiguration.cs
- Pointer.cs
- Size3DConverter.cs
- TableDetailsCollection.cs
- RegionData.cs
- PageThemeBuildProvider.cs
- DocumentSignatureManager.cs
- SafeProcessHandle.cs
- TypeName.cs
- ClientEventManager.cs
- EditingCoordinator.cs
- AsymmetricKeyExchangeDeformatter.cs
- Mouse.cs
- WeakEventTable.cs
- WindowsListViewScroll.cs
- BoundsDrawingContextWalker.cs
- EmptyCollection.cs
- MouseActionValueSerializer.cs
- WebBrowserUriTypeConverter.cs
- CheckedListBox.cs
- StorageTypeMapping.cs
- Decoder.cs
- Compiler.cs
- MemberRestriction.cs
- LicenseContext.cs
- TraceListener.cs
- EncryptedPackageFilter.cs
- WinFormsSecurity.cs
- PassportIdentity.cs
- EntityDataSourceViewSchema.cs
- PagedDataSource.cs
- DataSourceDescriptorCollection.cs
- StrokeIntersection.cs
- XmlAtomicValue.cs
- ActivityDelegate.cs
- XsltException.cs
- RuleSettings.cs
- SpotLight.cs
- DataListAutoFormat.cs
- TreeIterator.cs
- ValidationHelpers.cs
- Documentation.cs
- HyperLinkDataBindingHandler.cs
- ContentElement.cs
- GenericsInstances.cs
- ScriptControlDescriptor.cs
- DataGrid.cs
- SmiEventSink.cs
- HttpHandlersSection.cs
- UrlRoutingHandler.cs
- GacUtil.cs
- StylusOverProperty.cs
- NTAccount.cs
- SelectionPattern.cs
- EdmValidator.cs
- DataServiceProviderWrapper.cs
- ActivityValidator.cs
- NonVisualControlAttribute.cs
- DbCommandTree.cs
- EllipseGeometry.cs