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
- Binding.cs
- SQLRoleProvider.cs
- figurelength.cs
- ComplexTypeEmitter.cs
- DrawingContextWalker.cs
- NetworkInterface.cs
- TimeIntervalCollection.cs
- FormViewDeletedEventArgs.cs
- ToolStripComboBox.cs
- Menu.cs
- ScopeElementCollection.cs
- StylusDownEventArgs.cs
- RadioButtonPopupAdapter.cs
- EncryptedPackage.cs
- VirtualPath.cs
- DetailsView.cs
- FixedHighlight.cs
- HostSecurityManager.cs
- AnimatedTypeHelpers.cs
- RouteItem.cs
- WebPartHeaderCloseVerb.cs
- QilPatternFactory.cs
- DefaultPrintController.cs
- ISFClipboardData.cs
- ApplicationSecurityInfo.cs
- AuthenticationService.cs
- ValueChangedEventManager.cs
- InputLanguage.cs
- SequenceFullException.cs
- TranslateTransform.cs
- XmlSchemaSimpleTypeList.cs
- DateTimeOffset.cs
- NodeInfo.cs
- HitTestResult.cs
- XpsFilter.cs
- SafeProcessHandle.cs
- Intellisense.cs
- MediaContext.cs
- RuntimeConfigLKG.cs
- XmlnsDictionary.cs
- ParserOptions.cs
- ConfigurationSchemaErrors.cs
- InstanceNameConverter.cs
- GetIndexBinder.cs
- CannotUnloadAppDomainException.cs
- ScriptManager.cs
- SmiConnection.cs
- CompiledQueryCacheKey.cs
- DataGridViewColumnHeaderCell.cs
- WindowsListViewItem.cs
- AncestorChangedEventArgs.cs
- EmptyImpersonationContext.cs
- Page.cs
- ToolStripGripRenderEventArgs.cs
- FileDialog.cs
- ServiceModelStringsVersion1.cs
- XamlFilter.cs
- WebPartAddingEventArgs.cs
- ColorPalette.cs
- XmlTextReader.cs
- CopyNodeSetAction.cs
- SamlSecurityToken.cs
- CustomErrorCollection.cs
- DeclarationUpdate.cs
- TextServicesHost.cs
- XmlDeclaration.cs
- SecurityAlgorithmSuiteConverter.cs
- securestring.cs
- SqlBooleanMismatchVisitor.cs
- XmlTextReaderImplHelpers.cs
- XhtmlBasicLiteralTextAdapter.cs
- VisualStateChangedEventArgs.cs
- VirtualPathProvider.cs
- ProtocolsConfiguration.cs
- TypeNameConverter.cs
- PasswordBox.cs
- MediaElementAutomationPeer.cs
- ParallelTimeline.cs
- AtomMaterializerLog.cs
- ReceiveCompletedEventArgs.cs
- ListParagraph.cs
- XamlInt32CollectionSerializer.cs
- ScrollEvent.cs
- SchemaNamespaceManager.cs
- WebUtil.cs
- MsmqIntegrationInputMessage.cs
- AmbiguousMatchException.cs
- DragDropHelper.cs
- ITextView.cs
- TypeGeneratedEventArgs.cs
- DataAdapter.cs
- LogReserveAndAppendState.cs
- BitmapEffect.cs
- X509ImageLogo.cs
- XPathScanner.cs
- DependencyObjectType.cs
- RewritingValidator.cs
- EqualityComparer.cs
- ShapeTypeface.cs
- SQLBinary.cs