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
- ProcessInfo.cs
- RegistryKey.cs
- ByteStorage.cs
- SqlFlattener.cs
- MailSettingsSection.cs
- DataGridViewCellMouseEventArgs.cs
- ScriptingSectionGroup.cs
- XmlChildNodes.cs
- EFDataModelProvider.cs
- EntityDataSourceView.cs
- ButtonDesigner.cs
- DbParameterHelper.cs
- Automation.cs
- ContainerSelectorBehavior.cs
- DataGridViewHitTestInfo.cs
- DataGridViewCellCollection.cs
- SqlIdentifier.cs
- FeatureAttribute.cs
- NegotiateStream.cs
- RequestBringIntoViewEventArgs.cs
- JsonReaderDelegator.cs
- EntityRecordInfo.cs
- TextSelection.cs
- ForeignConstraint.cs
- BrowserDefinitionCollection.cs
- PeerInvitationResponse.cs
- ColumnResizeUndoUnit.cs
- RelationshipConstraintValidator.cs
- CompilerError.cs
- ConfigurationSettings.cs
- SwitchAttribute.cs
- VisualTreeHelper.cs
- FrameworkContentElementAutomationPeer.cs
- SqlClientMetaDataCollectionNames.cs
- StrongName.cs
- PartialTrustVisibleAssemblyCollection.cs
- Metadata.cs
- LinqDataSourceHelper.cs
- VirtualizedContainerService.cs
- TTSEngineProxy.cs
- ClientSettingsStore.cs
- MetabaseReader.cs
- CodeDefaultValueExpression.cs
- DataObjectSettingDataEventArgs.cs
- Size3DValueSerializer.cs
- FirstMatchCodeGroup.cs
- XmlSerializationGeneratedCode.cs
- MultipleViewPattern.cs
- SmtpNegotiateAuthenticationModule.cs
- QueueProcessor.cs
- SqlClientWrapperSmiStream.cs
- HostedHttpTransportManager.cs
- RoleGroupCollection.cs
- ResponseStream.cs
- DetailsViewDesigner.cs
- Identity.cs
- SamlAuthorityBinding.cs
- ListenerElementsCollection.cs
- ListView.cs
- Membership.cs
- RNGCryptoServiceProvider.cs
- cookiecontainer.cs
- RawUIStateInputReport.cs
- ToolStripScrollButton.cs
- MultiPropertyDescriptorGridEntry.cs
- Semaphore.cs
- MemberDomainMap.cs
- MdiWindowListItemConverter.cs
- Composition.cs
- XmlImplementation.cs
- VirtualPathUtility.cs
- DynamicEndpoint.cs
- WebPartDeleteVerb.cs
- FontSource.cs
- TableProviderWrapper.cs
- ProfileManager.cs
- ObjectDataSourceMethodEventArgs.cs
- InkCanvasFeedbackAdorner.cs
- DataGridCell.cs
- VideoDrawing.cs
- GenericRootAutomationPeer.cs
- SafeRegistryHandle.cs
- indexingfiltermarshaler.cs
- LinkButton.cs
- ViewLoader.cs
- SafeCryptoHandles.cs
- CodePageUtils.cs
- WS2007FederationHttpBindingElement.cs
- CommandField.cs
- RsaSecurityKey.cs
- WmlImageAdapter.cs
- BitmapSizeOptions.cs
- InheritanceAttribute.cs
- WorkflowMessageEventHandler.cs
- DelegateSerializationHolder.cs
- LogRestartAreaEnumerator.cs
- FamilyMap.cs
- InvokeProviderWrapper.cs
- DependencySource.cs
- ListParaClient.cs