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
- TextDataBindingHandler.cs
- NotifyParentPropertyAttribute.cs
- ScriptResourceHandler.cs
- StandardTransformFactory.cs
- CopyAttributesAction.cs
- BinaryUtilClasses.cs
- PolygonHotSpot.cs
- UTF7Encoding.cs
- OdbcTransaction.cs
- Bits.cs
- MultiPageTextView.cs
- Calendar.cs
- ProcessModelSection.cs
- DesignBindingConverter.cs
- CompareInfo.cs
- TimeZone.cs
- HtmlInputText.cs
- _NativeSSPI.cs
- XmlSchemaExternal.cs
- DataRecordInternal.cs
- BinaryCommonClasses.cs
- CalculatedColumn.cs
- OracleConnectionStringBuilder.cs
- HttpListenerRequest.cs
- HostingEnvironment.cs
- StorageBasedPackageProperties.cs
- storepermissionattribute.cs
- MonitoringDescriptionAttribute.cs
- UnsafeNativeMethods.cs
- MouseActionConverter.cs
- ReflectTypeDescriptionProvider.cs
- ClientType.cs
- Pair.cs
- TimeSpanSecondsConverter.cs
- ParameterElement.cs
- CompleteWizardStep.cs
- DPTypeDescriptorContext.cs
- precedingsibling.cs
- UIElementCollection.cs
- AspProxy.cs
- ImageAnimator.cs
- TargetConverter.cs
- GeometryGroup.cs
- RequestQueryProcessor.cs
- Pair.cs
- TextEmbeddedObject.cs
- GroupStyle.cs
- RunClient.cs
- ProcessingInstructionAction.cs
- NavigationWindow.cs
- WinFormsComponentEditor.cs
- ModuleConfigurationInfo.cs
- AnimationException.cs
- Int32Converter.cs
- DataGridViewRowHeaderCell.cs
- MenuBindingsEditorForm.cs
- TimeoutConverter.cs
- EnumMember.cs
- DebugController.cs
- ObjectDataSource.cs
- Button.cs
- PolygonHotSpot.cs
- Triplet.cs
- EntityModelBuildProvider.cs
- HtmlInputRadioButton.cs
- ContractReference.cs
- control.ime.cs
- XmlMembersMapping.cs
- XMLDiffLoader.cs
- NTAccount.cs
- CustomAssemblyResolver.cs
- IndentedWriter.cs
- ObjectListSelectEventArgs.cs
- InstanceStore.cs
- LazyTextWriterCreator.cs
- KeyFrames.cs
- TextSearch.cs
- CheckBoxStandardAdapter.cs
- ImpersonationContext.cs
- Root.cs
- HashCodeCombiner.cs
- AutomationElement.cs
- ValidationEventArgs.cs
- _LoggingObject.cs
- XmlC14NWriter.cs
- KnownColorTable.cs
- HandoffBehavior.cs
- TransformPattern.cs
- PointCollection.cs
- InternalBufferOverflowException.cs
- EntitySqlQueryCacheEntry.cs
- ApplicationSecurityManager.cs
- DbConnectionStringBuilder.cs
- GridViewUpdateEventArgs.cs
- ScriptingJsonSerializationSection.cs
- SubtreeProcessor.cs
- UpdateRecord.cs
- DeleteIndexBinder.cs
- SupportsEventValidationAttribute.cs
- WindowsComboBox.cs