Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / CompMod / System / Diagnostics / BooleanSwitch.cs / 1305376 / 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
- EditingMode.cs
- SystemIPv4InterfaceProperties.cs
- ListMarkerSourceInfo.cs
- ServiceOperationListItemList.cs
- WebUtility.cs
- PanningMessageFilter.cs
- BasicExpressionVisitor.cs
- HttpVersion.cs
- RuleConditionDialog.cs
- InvalidCastException.cs
- SimpleBitVector32.cs
- RuntimeConfigLKG.cs
- CodeExpressionCollection.cs
- DataServiceHostFactory.cs
- HttpModuleAction.cs
- MaskDescriptors.cs
- GlyphingCache.cs
- TypeExtensionSerializer.cs
- CompiledQuery.cs
- DataGridViewEditingControlShowingEventArgs.cs
- RadioButton.cs
- InvokeBase.cs
- EntityContainerEmitter.cs
- SafeProcessHandle.cs
- SingleTagSectionHandler.cs
- Material.cs
- CaseDesigner.xaml.cs
- DataSetMappper.cs
- DataGridRowAutomationPeer.cs
- UriTemplateEquivalenceComparer.cs
- RunClient.cs
- MemberInfoSerializationHolder.cs
- Ticks.cs
- RegisteredDisposeScript.cs
- TableRowCollection.cs
- SourceFileBuildProvider.cs
- DataColumn.cs
- SharedMemory.cs
- LockCookie.cs
- XmlIncludeAttribute.cs
- HwndHostAutomationPeer.cs
- XmlJsonReader.cs
- ClientTargetCollection.cs
- BitmapEffect.cs
- SafeHandles.cs
- OleDbFactory.cs
- EntitySetBaseCollection.cs
- SecurityBindingElement.cs
- SSmlParser.cs
- ToolStripGrip.cs
- DbProviderFactory.cs
- FieldCollectionEditor.cs
- JsonQNameDataContract.cs
- ColorMap.cs
- AutomationAttributeInfo.cs
- LinqDataSourceDeleteEventArgs.cs
- UrlMappingsSection.cs
- TrustManagerMoreInformation.cs
- NonBatchDirectoryCompiler.cs
- KnowledgeBase.cs
- ComPlusServiceHost.cs
- KeyManager.cs
- FrameworkTemplate.cs
- RegistryExceptionHelper.cs
- SoapFormatter.cs
- TemplateControlBuildProvider.cs
- SignatureHelper.cs
- ItemMap.cs
- DockAndAnchorLayout.cs
- UserUseLicenseDictionaryLoader.cs
- MarkupCompilePass2.cs
- LoginName.cs
- Drawing.cs
- DataServiceQueryContinuation.cs
- StructuralType.cs
- PropertyCondition.cs
- DataGridColumnsPage.cs
- BamlVersionHeader.cs
- AdornerLayer.cs
- LazyTextWriterCreator.cs
- ListenerConfig.cs
- ProgressBarBrushConverter.cs
- TextLine.cs
- Send.cs
- StateDesigner.Layouts.cs
- BamlVersionHeader.cs
- TabControlCancelEvent.cs
- XmlIterators.cs
- SqlBuffer.cs
- HierarchicalDataSourceControl.cs
- DataGridView.cs
- ListViewDataItem.cs
- SessionEndedEventArgs.cs
- IpcPort.cs
- AlternateView.cs
- ConfigurationCollectionAttribute.cs
- SoapException.cs
- SqlClientWrapperSmiStream.cs
- SqlDataSourceCache.cs
- Point.cs