Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / whidbey / NetFxQFE / ndp / fx / src / CompMod / System / Diagnostics / SwitchAttribute.cs / 1 / SwitchAttribute.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- using System; using System.Reflection; using System.Collections; namespace System.Diagnostics { [AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Class | AttributeTargets.Constructor | AttributeTargets.Event | AttributeTargets.Method | AttributeTargets.Property)] public sealed class SwitchAttribute : Attribute { private Type type; private string name; private string description; public SwitchAttribute (string switchName, Type switchType) { SwitchName = switchName; SwitchType = switchType; } public string SwitchName { get { return name; } set { if (value == null) throw new ArgumentNullException("value"); if (value.Length == 0) throw new ArgumentException(SR.GetString(SR.InvalidNullEmptyArgument, "value"), "value"); name = value; } } public Type SwitchType { get { return type; } set { if (value == null) throw new ArgumentNullException("value"); type = value; } } public string SwitchDescription { get { return description; } set { description = value;} } public static SwitchAttribute[] GetAll(Assembly assembly) { if (assembly == null) throw new ArgumentNullException("assembly"); ArrayList switchAttribs = new ArrayList (); object[] attribs = assembly.GetCustomAttributes(typeof(SwitchAttribute), false); switchAttribs.AddRange(attribs); Type[] types = assembly.GetTypes(); for (int i=0; i// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- using System; using System.Reflection; using System.Collections; namespace System.Diagnostics { [AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Class | AttributeTargets.Constructor | AttributeTargets.Event | AttributeTargets.Method | AttributeTargets.Property)] public sealed class SwitchAttribute : Attribute { private Type type; private string name; private string description; public SwitchAttribute (string switchName, Type switchType) { SwitchName = switchName; SwitchType = switchType; } public string SwitchName { get { return name; } set { if (value == null) throw new ArgumentNullException("value"); if (value.Length == 0) throw new ArgumentException(SR.GetString(SR.InvalidNullEmptyArgument, "value"), "value"); name = value; } } public Type SwitchType { get { return type; } set { if (value == null) throw new ArgumentNullException("value"); type = value; } } public string SwitchDescription { get { return description; } set { description = value;} } public static SwitchAttribute[] GetAll(Assembly assembly) { if (assembly == null) throw new ArgumentNullException("assembly"); ArrayList switchAttribs = new ArrayList (); object[] attribs = assembly.GetCustomAttributes(typeof(SwitchAttribute), false); switchAttribs.AddRange(attribs); Type[] types = assembly.GetTypes(); for (int i=0; i
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- BrowserCapabilitiesFactory.cs
- BufferedReadStream.cs
- SystemInfo.cs
- SQLRoleProvider.cs
- ComplexPropertyEntry.cs
- InternalBufferOverflowException.cs
- UIElementPropertyUndoUnit.cs
- BCLDebug.cs
- X509ChainElement.cs
- StorageMappingItemLoader.cs
- ReturnType.cs
- WebConfigurationHostFileChange.cs
- SR.Designer.cs
- CommandID.cs
- PointKeyFrameCollection.cs
- PropertyManager.cs
- cookie.cs
- DataGridViewCellStyleChangedEventArgs.cs
- ObjectTag.cs
- ContactManager.cs
- JournalEntryStack.cs
- WebEvents.cs
- ApplicationCommands.cs
- ErrorsHelper.cs
- ToolStripDropDownMenu.cs
- EmptyStringExpandableObjectConverter.cs
- FakeModelPropertyImpl.cs
- DocumentScope.cs
- FontSizeConverter.cs
- UserControlAutomationPeer.cs
- CurrencyManager.cs
- Buffer.cs
- Action.cs
- XPathScanner.cs
- PocoPropertyAccessorStrategy.cs
- ToolboxBitmapAttribute.cs
- XmlNodeChangedEventArgs.cs
- GatewayIPAddressInformationCollection.cs
- prefixendpointaddressmessagefiltertable.cs
- DataGridViewDataConnection.cs
- DataPagerField.cs
- XmlDeclaration.cs
- MetadataProperty.cs
- MemberProjectedSlot.cs
- Int32AnimationBase.cs
- GridViewItemAutomationPeer.cs
- basevalidator.cs
- ProviderIncompatibleException.cs
- DatasetMethodGenerator.cs
- GroupItemAutomationPeer.cs
- CompileXomlTask.cs
- DataGridColumnCollection.cs
- JournalEntryListConverter.cs
- DataProtectionSecurityStateEncoder.cs
- GlyphTypeface.cs
- LoginUtil.cs
- SecurityManager.cs
- DirectoryGroupQuery.cs
- CacheVirtualItemsEvent.cs
- PagedControl.cs
- AndCondition.cs
- TypedTableHandler.cs
- TaskHelper.cs
- _FixedSizeReader.cs
- SafeSecurityHelper.cs
- ButtonPopupAdapter.cs
- XmlTextReaderImplHelpers.cs
- Transform3DCollection.cs
- XpsS0ValidatingLoader.cs
- MetadataUtilsSmi.cs
- DbgUtil.cs
- WindowsFormsHelpers.cs
- AtomContentProperty.cs
- CreateParams.cs
- XPathNodeInfoAtom.cs
- BaseWebProxyFinder.cs
- CachedTypeface.cs
- StringSource.cs
- Validator.cs
- AsyncPostBackErrorEventArgs.cs
- HtmlElement.cs
- BulletedListEventArgs.cs
- VideoDrawing.cs
- RequestFactory.cs
- TreeNodeStyle.cs
- StringAnimationUsingKeyFrames.cs
- ProxyHwnd.cs
- ContentDisposition.cs
- CacheSection.cs
- OleDbParameter.cs
- TypeSystem.cs
- SqlUDTStorage.cs
- DrawingBrush.cs
- FilterQuery.cs
- ListItemCollection.cs
- ListControl.cs
- SqlFlattener.cs
- RtfNavigator.cs
- BindingNavigator.cs
- TableAdapterManagerHelper.cs