Code:
/ FX-1434 / FX-1434 / 1.0 / untmp / whidbey / REDBITS / 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(); } } }Specifies whether the switch is enabled /// ( ///) or disabled ( ).
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- CollectionBase.cs
- Size3D.cs
- FastEncoder.cs
- DataGridRowHeaderAutomationPeer.cs
- ExtensibleSyndicationObject.cs
- XamlTreeBuilder.cs
- ToolStripDropDownButton.cs
- PasswordRecovery.cs
- PopupRootAutomationPeer.cs
- UriExt.cs
- FileEnumerator.cs
- xsdvalidator.cs
- NewItemsContextMenuStrip.cs
- ObjectQuery_EntitySqlExtensions.cs
- MouseDevice.cs
- CalendarDay.cs
- TextBox.cs
- Evidence.cs
- SetStateEventArgs.cs
- QuinticEase.cs
- WebControl.cs
- XPathScanner.cs
- WindowsTreeView.cs
- DataServiceRequestArgs.cs
- RSACryptoServiceProvider.cs
- PropertyPanel.cs
- DiscreteKeyFrames.cs
- NamespaceExpr.cs
- GridViewHeaderRowPresenterAutomationPeer.cs
- DbQueryCommandTree.cs
- AttributeQuery.cs
- UnicodeEncoding.cs
- UndoManager.cs
- SelectedDatesCollection.cs
- EntityViewGenerator.cs
- GuidelineSet.cs
- ArrayTypeMismatchException.cs
- ToolStripContentPanel.cs
- ListenerChannelContext.cs
- ConstructorNeedsTagAttribute.cs
- APCustomTypeDescriptor.cs
- WizardStepBase.cs
- TextModifierScope.cs
- DoubleCollectionValueSerializer.cs
- assemblycache.cs
- PowerStatus.cs
- SystemResources.cs
- _DisconnectOverlappedAsyncResult.cs
- InkCanvasSelectionAdorner.cs
- DataKeyCollection.cs
- HandledEventArgs.cs
- PieceNameHelper.cs
- HttpProcessUtility.cs
- UndoManager.cs
- SrgsDocumentParser.cs
- BaseResourcesBuildProvider.cs
- HtmlObjectListAdapter.cs
- AutomationElement.cs
- MailMessage.cs
- SqlDataSourceQuery.cs
- VoiceInfo.cs
- KeyPullup.cs
- DataGridViewColumnCollection.cs
- StyleSheetRefUrlEditor.cs
- ISAPIApplicationHost.cs
- SemanticResolver.cs
- FileDialogPermission.cs
- NullableConverter.cs
- ScopeCompiler.cs
- FormViewPagerRow.cs
- Selection.cs
- DropTarget.cs
- WebPartConnectionCollection.cs
- DataGridViewControlCollection.cs
- TextElementEnumerator.cs
- FileVersionInfo.cs
- TreeNodeBinding.cs
- WorkflowRequestContext.cs
- MessageFault.cs
- TreeNodeCollection.cs
- BitmapSource.cs
- ResourceReferenceKeyNotFoundException.cs
- TdsValueSetter.cs
- FixedTextView.cs
- XmlMemberMapping.cs
- SmtpReplyReaderFactory.cs
- DocumentPage.cs
- VirtualPathUtility.cs
- RectangleHotSpot.cs
- IgnoreDeviceFilterElement.cs
- SkipStoryboardToFill.cs
- BaseAppDomainProtocolHandler.cs
- PackagingUtilities.cs
- XmlConverter.cs
- IISUnsafeMethods.cs
- StrongNameIdentityPermission.cs
- ComboBox.cs
- Decorator.cs
- ElementFactory.cs
- FileAuthorizationModule.cs