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
- SecurityPermission.cs
- ThemeableAttribute.cs
- SizeConverter.cs
- PrimaryKeyTypeConverter.cs
- PageStatePersister.cs
- RoleManagerEventArgs.cs
- XmlNodeWriter.cs
- UnionCodeGroup.cs
- ContractAdapter.cs
- ResXFileRef.cs
- FieldTemplateFactory.cs
- WebPartCancelEventArgs.cs
- DelegateOutArgument.cs
- AssertFilter.cs
- SqlLiftWhereClauses.cs
- SHA256.cs
- ResolvedKeyFrameEntry.cs
- MessageRpc.cs
- ProjectionAnalyzer.cs
- BitmapEffectGeneralTransform.cs
- ExternalException.cs
- EqualityComparer.cs
- InternalConfigRoot.cs
- AmbientLight.cs
- D3DImage.cs
- InstanceValue.cs
- WindowsSolidBrush.cs
- WebSysDisplayNameAttribute.cs
- IncrementalReadDecoders.cs
- TagElement.cs
- ViewLoader.cs
- HideDisabledControlAdapter.cs
- CodeTryCatchFinallyStatement.cs
- IdleTimeoutMonitor.cs
- StaticExtension.cs
- GuidelineSet.cs
- AnnotationMap.cs
- GeneralTransform3DCollection.cs
- RemotingConfigParser.cs
- LineServicesCallbacks.cs
- XmlBinaryWriterSession.cs
- DataSourceDescriptorCollection.cs
- HtmlTextArea.cs
- SpAudioStreamWrapper.cs
- SafeRegistryHandle.cs
- AssertFilter.cs
- _HeaderInfoTable.cs
- SpecialNameAttribute.cs
- ClientScriptManagerWrapper.cs
- SQLMembershipProvider.cs
- UdpDiscoveryEndpointElement.cs
- HuffCodec.cs
- StylusEventArgs.cs
- AuthenticateEventArgs.cs
- WebPartUtil.cs
- ToolBarTray.cs
- ContentPropertyAttribute.cs
- IgnoreFileBuildProvider.cs
- BackgroundFormatInfo.cs
- PrimitiveCodeDomSerializer.cs
- CRYPTPROTECT_PROMPTSTRUCT.cs
- DataRowExtensions.cs
- EntityRecordInfo.cs
- XpsResource.cs
- SynthesizerStateChangedEventArgs.cs
- ClientTargetSection.cs
- XmlSchemaGroupRef.cs
- _LazyAsyncResult.cs
- RMEnrollmentPage1.cs
- StringAnimationBase.cs
- ActiveXSite.cs
- RelationshipNavigation.cs
- MenuEventArgs.cs
- RecognitionEventArgs.cs
- dataprotectionpermissionattribute.cs
- KeyInterop.cs
- XmlSerializableWriter.cs
- Propagator.cs
- XmlSchemaComplexContentRestriction.cs
- GlobalizationAssembly.cs
- HiddenFieldPageStatePersister.cs
- LinearGradientBrush.cs
- PeerNameRegistration.cs
- KeyGesture.cs
- ReverseInheritProperty.cs
- HierarchicalDataTemplate.cs
- PaintEvent.cs
- TerminatorSinks.cs
- PersonalizationEntry.cs
- ExecutionScope.cs
- EntityClassGenerator.cs
- FloatUtil.cs
- SqlDataSource.cs
- ProfileGroupSettingsCollection.cs
- CodeMethodInvokeExpression.cs
- VersionUtil.cs
- PngBitmapDecoder.cs
- TransactionInformation.cs
- FileDialog.cs
- UserPreferenceChangedEventArgs.cs