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
- WebReference.cs
- DataGridViewButtonColumn.cs
- ConnectionStringSettingsCollection.cs
- KeyValuePair.cs
- ExpressionConverter.cs
- RSAPKCS1KeyExchangeFormatter.cs
- RegisteredArrayDeclaration.cs
- ProtocolsConfigurationHandler.cs
- HtmlInputButton.cs
- ParagraphVisual.cs
- CorruptStoreException.cs
- BasicCommandTreeVisitor.cs
- DBSchemaRow.cs
- UTF32Encoding.cs
- XmlObjectSerializerWriteContextComplex.cs
- WindowsListView.cs
- ControlCachePolicy.cs
- ServiceDescriptions.cs
- XmlTextReaderImplHelpers.cs
- DetailsView.cs
- SettingsPropertyWrongTypeException.cs
- NativeMethods.cs
- ContentType.cs
- Codec.cs
- DoubleCollection.cs
- OpenTypeLayout.cs
- AnnotationResourceCollection.cs
- AutoGeneratedFieldProperties.cs
- DesignerSerializationOptionsAttribute.cs
- HtmlDocument.cs
- TextReader.cs
- ToolStripItemImageRenderEventArgs.cs
- AttributeUsageAttribute.cs
- SmtpTransport.cs
- Collection.cs
- InstanceCreationEditor.cs
- UrlMapping.cs
- ToolboxItemFilterAttribute.cs
- Update.cs
- XmlTypeAttribute.cs
- Converter.cs
- BoundField.cs
- ImageListStreamer.cs
- TreeView.cs
- ErrorRuntimeConfig.cs
- RegistryPermission.cs
- Stream.cs
- BigIntegerStorage.cs
- StoreContentChangedEventArgs.cs
- DBNull.cs
- ActivatableWorkflowsQueryResult.cs
- TreeNodeStyle.cs
- DataColumnChangeEvent.cs
- TextProviderWrapper.cs
- FloaterParagraph.cs
- RuleSetDialog.cs
- SizeAnimationBase.cs
- SymbolMethod.cs
- BinaryObjectReader.cs
- FontFamily.cs
- regiisutil.cs
- WebPartEditorApplyVerb.cs
- RecordConverter.cs
- ThreadPool.cs
- ToolStripContentPanel.cs
- StringComparer.cs
- DesignerPerfEventProvider.cs
- WebConfigurationHost.cs
- xmlformatgeneratorstatics.cs
- VoiceChangeEventArgs.cs
- SettingsProperty.cs
- Int16Converter.cs
- SspiHelper.cs
- TableRow.cs
- RtfFormatStack.cs
- SRGSCompiler.cs
- StringPropertyBuilder.cs
- Parameter.cs
- XmlTextWriter.cs
- UIElement3D.cs
- DbReferenceCollection.cs
- WebConfigurationManager.cs
- StylusPointProperty.cs
- RuntimeDelegateArgument.cs
- BindingMemberInfo.cs
- Rules.cs
- ToolStripItemClickedEventArgs.cs
- MailSettingsSection.cs
- RegexFCD.cs
- SQLStringStorage.cs
- CngProvider.cs
- Grammar.cs
- Baml2006Reader.cs
- COM2Properties.cs
- MarkupCompilePass1.cs
- PageHandlerFactory.cs
- TextRunCacheImp.cs
- LocatorPart.cs
- OrderedDictionaryStateHelper.cs
- ContractCodeDomInfo.cs