Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / whidbey / NetFXspW7 / 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
- PersonalizationDictionary.cs
- XmlSchemaAttribute.cs
- SafeThreadHandle.cs
- JavaScriptSerializer.cs
- SrgsSemanticInterpretationTag.cs
- GlobalDataBindingHandler.cs
- SafeFileHandle.cs
- BitmapImage.cs
- FontStretch.cs
- InertiaExpansionBehavior.cs
- DataGridViewColumnHeaderCell.cs
- TemplateParser.cs
- SQLBinary.cs
- GridViewSelectEventArgs.cs
- GeometryGroup.cs
- LinearGradientBrush.cs
- ListViewUpdatedEventArgs.cs
- MimeImporter.cs
- TemplateGroupCollection.cs
- SubtreeProcessor.cs
- KeyGestureConverter.cs
- MimeTypeMapper.cs
- ToolboxBitmapAttribute.cs
- GACMembershipCondition.cs
- WebBrowserBase.cs
- ItemAutomationPeer.cs
- MenuItemBindingCollection.cs
- Normalizer.cs
- Stacktrace.cs
- IDictionary.cs
- HelpFileFileNameEditor.cs
- DefaultPropertyAttribute.cs
- Expressions.cs
- WebPartChrome.cs
- InputLanguageProfileNotifySink.cs
- ItemList.cs
- MinimizableAttributeTypeConverter.cs
- CommonObjectSecurity.cs
- BaseDataList.cs
- CodeBlockBuilder.cs
- IdentityHolder.cs
- TextParaClient.cs
- AttributeCollection.cs
- StyleCollection.cs
- ConfigurationStrings.cs
- ObjectAnimationUsingKeyFrames.cs
- CodeConstructor.cs
- LinqDataSourceView.cs
- BehaviorEditorPart.cs
- DesignTableCollection.cs
- ListBox.cs
- MethodCallConverter.cs
- GeneralTransform3DCollection.cs
- CultureInfoConverter.cs
- MarginCollapsingState.cs
- ToolTipService.cs
- XmlSchemaExternal.cs
- DispatcherOperation.cs
- CodeVariableDeclarationStatement.cs
- SchemaImporterExtensionElementCollection.cs
- JournalNavigationScope.cs
- ZipIOCentralDirectoryBlock.cs
- SQLChars.cs
- HttpListener.cs
- TableItemPattern.cs
- ClaimTypeRequirement.cs
- DecimalStorage.cs
- HelpEvent.cs
- Compiler.cs
- Avt.cs
- SelectionPattern.cs
- RectangleGeometry.cs
- COMException.cs
- ItemChangedEventArgs.cs
- CompressionTransform.cs
- StrokeCollection2.cs
- Stroke2.cs
- ToolboxItemAttribute.cs
- SegmentInfo.cs
- CodeMethodMap.cs
- _SecureChannel.cs
- MouseCaptureWithinProperty.cs
- MetabaseSettings.cs
- SortQuery.cs
- ParallelDesigner.cs
- KeySplineConverter.cs
- TdsParserHelperClasses.cs
- DataServices.cs
- MailWebEventProvider.cs
- Nodes.cs
- ProcessHostFactoryHelper.cs
- StorageScalarPropertyMapping.cs
- InputMethodStateChangeEventArgs.cs
- QilSortKey.cs
- WindowsAuthenticationEventArgs.cs
- WindowClosedEventArgs.cs
- ObjectStateEntry.cs
- X509SecurityTokenProvider.cs
- IpcChannelHelper.cs
- MemberRelationshipService.cs