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
- CodeAttributeArgument.cs
- RecipientInfo.cs
- ListItemConverter.cs
- Exceptions.cs
- ReadOnlyNameValueCollection.cs
- RemotingServices.cs
- odbcmetadatacolumnnames.cs
- TypeExtensionConverter.cs
- SortFieldComparer.cs
- ControlCollection.cs
- Query.cs
- CopyOfAction.cs
- XPathParser.cs
- ComPlusSynchronizationContext.cs
- SettingsPropertyIsReadOnlyException.cs
- OdbcConnectionHandle.cs
- SqlDependencyListener.cs
- DataGridTextBoxColumn.cs
- Types.cs
- FtpWebResponse.cs
- VarRefManager.cs
- LoaderAllocator.cs
- Trace.cs
- MessageSecurityOverMsmqElement.cs
- AuthenticationModuleElement.cs
- UriWriter.cs
- TextEvent.cs
- ErrorFormatter.cs
- CollectionChangedEventManager.cs
- ConfigurationValidatorBase.cs
- arabicshape.cs
- ActiveXHost.cs
- ZoneMembershipCondition.cs
- RepeatInfo.cs
- BaseUriHelper.cs
- ToolStripLabel.cs
- WrapPanel.cs
- WindowInteractionStateTracker.cs
- WebPermission.cs
- XmlCDATASection.cs
- ClientSettingsProvider.cs
- RadioButton.cs
- EditingContext.cs
- SamlConstants.cs
- GreaterThanOrEqual.cs
- SourceSwitch.cs
- DocumentSignatureManager.cs
- DataGridViewCellStateChangedEventArgs.cs
- EntitySetDataBindingList.cs
- Error.cs
- XmlElementAttribute.cs
- RewritingSimplifier.cs
- PenContexts.cs
- HttpServerProtocol.cs
- PathStreamGeometryContext.cs
- FreezableDefaultValueFactory.cs
- SelectionChangedEventArgs.cs
- SmiContextFactory.cs
- DoubleIndependentAnimationStorage.cs
- ItemTypeToolStripMenuItem.cs
- AdornerHitTestResult.cs
- AttachmentService.cs
- Wizard.cs
- SiteMapDesignerDataSourceView.cs
- X509Certificate2.cs
- EventArgs.cs
- WebPartEditVerb.cs
- SqlCacheDependency.cs
- Expressions.cs
- Label.cs
- ConnectionStringsSection.cs
- DataShape.cs
- PrefixHandle.cs
- Visitor.cs
- ComponentEditorPage.cs
- BitmapFrameEncode.cs
- OperationInvokerBehavior.cs
- WebPartEditVerb.cs
- AuthenticationSection.cs
- OracleParameterBinding.cs
- XmlBinaryReaderSession.cs
- XmlnsCache.cs
- ClientApiGenerator.cs
- ObsoleteAttribute.cs
- PropertyTabChangedEvent.cs
- InvalidComObjectException.cs
- FaultBookmark.cs
- ToolboxItemAttribute.cs
- XamlStyleSerializer.cs
- CodePageUtils.cs
- LoginDesignerUtil.cs
- KoreanLunisolarCalendar.cs
- ActivityXamlServices.cs
- HttpStaticObjectsCollectionBase.cs
- XmlSchemaSequence.cs
- WebZone.cs
- ProbeMatches11.cs
- DataGridViewLinkCell.cs
- ScriptingWebServicesSectionGroup.cs
- FileLevelControlBuilderAttribute.cs