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
- GeneralTransform2DTo3D.cs
- ClickablePoint.cs
- OverlappedContext.cs
- ByteArrayHelperWithString.cs
- SaveFileDialog.cs
- GrammarBuilderDictation.cs
- IPHostEntry.cs
- CompoundFileStreamReference.cs
- UserPersonalizationStateInfo.cs
- Transactions.cs
- DispatcherObject.cs
- OrthographicCamera.cs
- DataListItem.cs
- TextBoxBase.cs
- ContextMarshalException.cs
- PersonalizationStateQuery.cs
- ResourcesBuildProvider.cs
- _SSPISessionCache.cs
- SharedUtils.cs
- Internal.cs
- elementinformation.cs
- ToolStripStatusLabel.cs
- DispatcherExceptionFilterEventArgs.cs
- CheckedListBox.cs
- RuleProcessor.cs
- NamedPipeTransportBindingElement.cs
- PageParser.cs
- SortKey.cs
- EntityDataSourceChangingEventArgs.cs
- BitmapEffectrendercontext.cs
- StringUtil.cs
- DbExpressionBuilder.cs
- ExpressionBinding.cs
- GeometryHitTestResult.cs
- ClientFormsAuthenticationCredentials.cs
- TerminatorSinks.cs
- SqlCacheDependencyDatabase.cs
- ErrorReporting.cs
- NativeMethods.cs
- DataGridViewTextBoxColumn.cs
- PersonalizableAttribute.cs
- FactoryId.cs
- WizardForm.cs
- StickyNoteAnnotations.cs
- FlowDocumentView.cs
- ListControl.cs
- ColorTranslator.cs
- AnimationClock.cs
- Int64Storage.cs
- Keyboard.cs
- NavigationExpr.cs
- TypePropertyEditor.cs
- InternalConfigRoot.cs
- SeverityFilter.cs
- LoginCancelEventArgs.cs
- TraceProvider.cs
- _ScatterGatherBuffers.cs
- SqlNotificationRequest.cs
- Bitmap.cs
- Bidi.cs
- ObjectQueryProvider.cs
- ResourcesChangeInfo.cs
- EntityContainerRelationshipSetEnd.cs
- CheckBoxBaseAdapter.cs
- MenuEventArgs.cs
- WeakReadOnlyCollection.cs
- XmlSchemaDocumentation.cs
- InternalControlCollection.cs
- DragDropHelper.cs
- XslVisitor.cs
- PageVisual.cs
- DocumentEventArgs.cs
- BinaryParser.cs
- ConvertEvent.cs
- FixedSOMImage.cs
- FrameworkReadOnlyPropertyMetadata.cs
- ObjectListFieldsPage.cs
- DrawListViewSubItemEventArgs.cs
- CancellationTokenSource.cs
- NCryptSafeHandles.cs
- Point.cs
- WebEventCodes.cs
- XmlAtomErrorReader.cs
- WindowsRichEdit.cs
- BaseDataBoundControlDesigner.cs
- DesignerHost.cs
- Attributes.cs
- DocumentApplicationJournalEntry.cs
- TextViewSelectionProcessor.cs
- BuildProvider.cs
- Splitter.cs
- HtmlAnchor.cs
- UntypedNullExpression.cs
- SoapCodeExporter.cs
- HeaderCollection.cs
- Exceptions.cs
- OutputCacheSettingsSection.cs
- _ShellExpression.cs
- SeparatorAutomationPeer.cs
- TextServicesCompartment.cs