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
- ItemsChangedEventArgs.cs
- TdsValueSetter.cs
- DiscoveryReferences.cs
- GraphicsContext.cs
- Visual3D.cs
- Hyperlink.cs
- PropertyGridEditorPart.cs
- SmiEventSink.cs
- SqlProfileProvider.cs
- ToolStripDropDownClosedEventArgs.cs
- HtmlPhoneCallAdapter.cs
- HeaderedItemsControl.cs
- FixedSOMPageElement.cs
- BeginEvent.cs
- CngKey.cs
- PageFunction.cs
- ObjectQuery_EntitySqlExtensions.cs
- DateTimeStorage.cs
- SqlCacheDependencyDatabaseCollection.cs
- OperationParameterInfoCollection.cs
- ListViewInsertionMark.cs
- HtmlElementErrorEventArgs.cs
- ResXFileRef.cs
- Section.cs
- SrgsGrammarCompiler.cs
- TimeoutException.cs
- KnownIds.cs
- AccessText.cs
- ResourceExpressionBuilder.cs
- JavaScriptSerializer.cs
- RecognizerStateChangedEventArgs.cs
- _TLSstream.cs
- ProcessStartInfo.cs
- TransactionManager.cs
- Rule.cs
- XmlException.cs
- SQLBinary.cs
- _IPv4Address.cs
- ControlBuilder.cs
- NameTable.cs
- HandledMouseEvent.cs
- __TransparentProxy.cs
- EventSourceCreationData.cs
- Collection.cs
- Stream.cs
- WorkflowApplicationCompletedEventArgs.cs
- StoreItemCollection.cs
- BaseAsyncResult.cs
- TreeNodeCollectionEditorDialog.cs
- TraceContextEventArgs.cs
- LinqDataSourceView.cs
- HttpValueCollection.cs
- WebControlsSection.cs
- CheckBoxStandardAdapter.cs
- EditingCommands.cs
- InstanceDescriptor.cs
- ConnectionManagementElement.cs
- DataSourceControlBuilder.cs
- LinqDataSourceDeleteEventArgs.cs
- EdmPropertyAttribute.cs
- MD5.cs
- DebugViewWriter.cs
- DataGridColumnCollection.cs
- ImageDrawing.cs
- DocComment.cs
- OutputCacheSettings.cs
- ReflectPropertyDescriptor.cs
- ListControlConvertEventArgs.cs
- LiteralText.cs
- XmlObjectSerializerReadContextComplex.cs
- OutputCacheEntry.cs
- AssertValidation.cs
- QilGenerator.cs
- BCryptNative.cs
- DigitShape.cs
- EntityConnectionStringBuilder.cs
- CellCreator.cs
- UrlAuthorizationModule.cs
- QilTypeChecker.cs
- TypographyProperties.cs
- CharConverter.cs
- PrintingPermissionAttribute.cs
- ToolStripManager.cs
- AlgoModule.cs
- StackBuilderSink.cs
- EventMappingSettings.cs
- EntityDataSource.cs
- TileBrush.cs
- GraphicsPathIterator.cs
- TextContainerChangeEventArgs.cs
- __TransparentProxy.cs
- EnumUnknown.cs
- DesignConnectionCollection.cs
- MouseEvent.cs
- InstanceKey.cs
- DirectoryRedirect.cs
- Executor.cs
- XmlQueryRuntime.cs
- ListQueryResults.cs
- StringBuilder.cs