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
- ReversePositionQuery.cs
- TextModifierScope.cs
- EncoderParameters.cs
- DataViewManager.cs
- MbpInfo.cs
- NodeInfo.cs
- ZipIOCentralDirectoryFileHeader.cs
- Journaling.cs
- FormViewDeletedEventArgs.cs
- XmlnsDictionary.cs
- Funcletizer.cs
- ConcurrentDictionary.cs
- DispatcherFrame.cs
- TypeLibConverter.cs
- PropertyInfoSet.cs
- CultureInfoConverter.cs
- BuildDependencySet.cs
- WebPartMenu.cs
- DataSourceDesigner.cs
- EnumDataContract.cs
- Underline.cs
- x509utils.cs
- DBDataPermission.cs
- SingleAnimationUsingKeyFrames.cs
- GeneralTransform2DTo3D.cs
- XmlUnspecifiedAttribute.cs
- ServiceThrottle.cs
- BinaryKeyIdentifierClause.cs
- UnaryNode.cs
- ToolTipService.cs
- NavigationPropertySingletonExpression.cs
- PeerReferralPolicy.cs
- TriState.cs
- DBSchemaRow.cs
- SettingsSection.cs
- ParseChildrenAsPropertiesAttribute.cs
- XmlValueConverter.cs
- IntPtr.cs
- KeyPullup.cs
- ObjectViewFactory.cs
- MarkupExtensionParser.cs
- AutoResizedEvent.cs
- NavigationCommands.cs
- BinHexDecoder.cs
- HttpCapabilitiesBase.cs
- TraceRecord.cs
- Viewport3DVisual.cs
- ClientSession.cs
- ProcessModelSection.cs
- TreeNodeStyleCollection.cs
- ListItemParagraph.cs
- SpotLight.cs
- MetadataItem_Static.cs
- XPathAxisIterator.cs
- KeyEventArgs.cs
- XPathNodeHelper.cs
- DispatcherExceptionEventArgs.cs
- XmlnsCompatibleWithAttribute.cs
- BitmapEffectGroup.cs
- HttpWriter.cs
- RepeatButtonAutomationPeer.cs
- CacheRequest.cs
- XmlMtomReader.cs
- RelationshipConstraintValidator.cs
- BufferAllocator.cs
- DelegateHelpers.cs
- DesignerForm.cs
- CommonObjectSecurity.cs
- OperationResponse.cs
- CodePrimitiveExpression.cs
- ObjectViewEntityCollectionData.cs
- AlternateViewCollection.cs
- DataViewListener.cs
- AccessKeyManager.cs
- Soap12ProtocolImporter.cs
- CacheMemory.cs
- RuleRef.cs
- MetabaseReader.cs
- Padding.cs
- GenerateScriptTypeAttribute.cs
- SoapSchemaMember.cs
- ParserHooks.cs
- Figure.cs
- ReplacementText.cs
- BufferedGraphics.cs
- SByteConverter.cs
- ScriptingWebServicesSectionGroup.cs
- ApplicationBuildProvider.cs
- WebPartTransformerCollection.cs
- RightsManagementEncryptedStream.cs
- TreeViewImageKeyConverter.cs
- ExpressionNode.cs
- PassportPrincipal.cs
- PrintingPermission.cs
- IApplicationTrustManager.cs
- OpenTypeLayout.cs
- PolicyManager.cs
- SortKey.cs
- HttpClientProtocol.cs
- PolyQuadraticBezierSegment.cs