Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / CompMod / System / Diagnostics / SwitchAttribute.cs / 1305376 / 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
- ActivitySurrogate.cs
- HostedImpersonationContext.cs
- _ShellExpression.cs
- AsyncParams.cs
- LicenseContext.cs
- DetailsViewPagerRow.cs
- HyperLinkDesigner.cs
- WebPartConnection.cs
- WebPartTracker.cs
- Decoder.cs
- ArrayList.cs
- CompoundFileReference.cs
- OuterGlowBitmapEffect.cs
- Quad.cs
- StrongNameUtility.cs
- cache.cs
- Point4DValueSerializer.cs
- TemplateKeyConverter.cs
- CodeLabeledStatement.cs
- WebPart.cs
- ComponentCollection.cs
- TimeZone.cs
- DataBindingCollection.cs
- Simplifier.cs
- ErasingStroke.cs
- ApplicationContext.cs
- CodeTypeDelegate.cs
- TempFiles.cs
- SrgsSubset.cs
- InvokeHandlers.cs
- XmlTextWriter.cs
- FixedPosition.cs
- CollectionViewGroupRoot.cs
- NativeMethods.cs
- OperationContextScope.cs
- SiteMapDataSource.cs
- DrawingVisualDrawingContext.cs
- StringConcat.cs
- diagnosticsswitches.cs
- TypedTableBase.cs
- CodeNamespace.cs
- MarshalByRefObject.cs
- ConfigurationProperty.cs
- FlowDocument.cs
- GridViewSelectEventArgs.cs
- ConnectionManagementElement.cs
- InternalsVisibleToAttribute.cs
- NodeFunctions.cs
- DBCSCodePageEncoding.cs
- ExpressionBuilderContext.cs
- DescendentsWalkerBase.cs
- TranslateTransform3D.cs
- QilInvoke.cs
- DesignTimeValidationFeature.cs
- ExportOptions.cs
- BitmapImage.cs
- CallbackHandler.cs
- DtrList.cs
- TimelineGroup.cs
- UnsafeNativeMethods.cs
- X509Utils.cs
- WindowsGrip.cs
- ColorMap.cs
- Subtree.cs
- ButtonRenderer.cs
- BamlLocalizableResource.cs
- CustomValidator.cs
- CellCreator.cs
- SimpleBitVector32.cs
- WebPartTransformerCollection.cs
- ChangePasswordDesigner.cs
- ReadOnlyDataSource.cs
- BaseCodePageEncoding.cs
- DragCompletedEventArgs.cs
- SchemaNames.cs
- ExceptionAggregator.cs
- XsdDuration.cs
- SqlInternalConnectionSmi.cs
- LateBoundBitmapDecoder.cs
- FrameworkReadOnlyPropertyMetadata.cs
- ExpressionEditorAttribute.cs
- Rect3D.cs
- ObjectDataSourceDisposingEventArgs.cs
- URLMembershipCondition.cs
- Section.cs
- PreloadedPackages.cs
- VectorKeyFrameCollection.cs
- GeneratedView.cs
- WmlCalendarAdapter.cs
- DocumentReferenceCollection.cs
- FixedMaxHeap.cs
- ImplicitInputBrush.cs
- MergablePropertyAttribute.cs
- DataObjectFieldAttribute.cs
- HelloOperation11AsyncResult.cs
- ListViewItem.cs
- XmlSchemaObjectCollection.cs
- PrintPreviewControl.cs
- ContentElement.cs
- ConfigXmlReader.cs