Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / whidbey / NetFxQFE / 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
- SqlDataRecord.cs
- ProxyWebPartConnectionCollection.cs
- KeyToListMap.cs
- WebPartConnectionsConfigureVerb.cs
- ReadWriteSpinLock.cs
- MethodExpr.cs
- BinHexDecoder.cs
- Selector.cs
- WebPartExportVerb.cs
- Model3D.cs
- SubqueryRules.cs
- XsdValidatingReader.cs
- DataGridCaption.cs
- HttpApplicationFactory.cs
- AssemblyUtil.cs
- GeneralTransformGroup.cs
- GridProviderWrapper.cs
- Suspend.cs
- TableColumnCollectionInternal.cs
- ListControlActionList.cs
- SourceFileInfo.cs
- DbConnectionPoolCounters.cs
- OracleMonthSpan.cs
- AdapterUtil.cs
- PackageDigitalSignature.cs
- ValueProviderWrapper.cs
- SimpleLine.cs
- BulletedList.cs
- CodeNamespaceImportCollection.cs
- httpserverutility.cs
- KerberosRequestorSecurityTokenAuthenticator.cs
- Base64Encoder.cs
- WebPartZoneBase.cs
- MbpInfo.cs
- _ConnectStream.cs
- QilXmlReader.cs
- HttpRuntime.cs
- TableStyle.cs
- EDesignUtil.cs
- WCFServiceClientProxyGenerator.cs
- HtmlHistory.cs
- DispatcherTimer.cs
- BodyGlyph.cs
- SkinBuilder.cs
- CreatingCookieEventArgs.cs
- ConstantSlot.cs
- VideoDrawing.cs
- HtmlButton.cs
- EventProviderClassic.cs
- RequestQueue.cs
- ConditionedDesigner.cs
- Cursor.cs
- JapaneseLunisolarCalendar.cs
- RowVisual.cs
- ApplicationDirectoryMembershipCondition.cs
- SuppressMessageAttribute.cs
- DataSourceGroupCollection.cs
- ListView.cs
- ValueHandle.cs
- GlyphRunDrawing.cs
- Vector3DAnimationUsingKeyFrames.cs
- FormsAuthenticationUser.cs
- WebServiceBindingAttribute.cs
- DescendantQuery.cs
- ObjectStateEntryBaseUpdatableDataRecord.cs
- AssemblyFilter.cs
- KeysConverter.cs
- XmlChildNodes.cs
- Baml2006KnownTypes.cs
- PathFigure.cs
- DiscoveryClient.cs
- DataTablePropertyDescriptor.cs
- PropertyChangedEventArgs.cs
- OverlappedAsyncResult.cs
- HwndSource.cs
- TextLineBreak.cs
- XmlReturnWriter.cs
- NumberFormatter.cs
- XmlConvert.cs
- StreamSecurityUpgradeAcceptorBase.cs
- EntityCommandCompilationException.cs
- Soap11ServerProtocol.cs
- UpdateExpressionVisitor.cs
- MultiBinding.cs
- MeasurementDCInfo.cs
- RtfToXamlReader.cs
- ValidatedControlConverter.cs
- SystemIPGlobalStatistics.cs
- Clipboard.cs
- WmlValidatorAdapter.cs
- ExcCanonicalXml.cs
- FontStyles.cs
- GetWinFXPath.cs
- HtmlListAdapter.cs
- Route.cs
- CustomLineCap.cs
- WasEndpointConfigContainer.cs
- XmlEntity.cs
- RijndaelManagedTransform.cs
- NativeCompoundFileAPIs.cs