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
- DetailsViewRowCollection.cs
- SessionIDManager.cs
- XmlSchemaComplexType.cs
- OleDbParameterCollection.cs
- ToolStripItemClickedEventArgs.cs
- TlsnegoTokenProvider.cs
- InheritanceContextHelper.cs
- AlternateView.cs
- WmlCommandAdapter.cs
- TextElementEnumerator.cs
- DocumentXPathNavigator.cs
- Cursor.cs
- versioninfo.cs
- ProfilePropertyNameValidator.cs
- ContourSegment.cs
- FontStyleConverter.cs
- HiddenField.cs
- ContourSegment.cs
- InstanceKeyCollisionException.cs
- DataGridRow.cs
- WindowsListViewGroupHelper.cs
- XmlSortKey.cs
- PingOptions.cs
- ResXResourceSet.cs
- ProcessThread.cs
- OleDbException.cs
- httpstaticobjectscollection.cs
- DeliveryRequirementsAttribute.cs
- StylusEditingBehavior.cs
- DocComment.cs
- Type.cs
- PropertyDescriptor.cs
- TypefaceCollection.cs
- MethodBuilderInstantiation.cs
- SaveFileDialog.cs
- CollectionChangeEventArgs.cs
- XmlSerializerFactory.cs
- CodeSnippetCompileUnit.cs
- SQLDoubleStorage.cs
- StorageTypeMapping.cs
- SqlFormatter.cs
- GeneralTransform3DTo2D.cs
- TextChange.cs
- RelatedCurrencyManager.cs
- EmptyCollection.cs
- XmlEncoding.cs
- SqlReorderer.cs
- UnionCodeGroup.cs
- RectangleGeometry.cs
- WebPartAddingEventArgs.cs
- StringValueSerializer.cs
- FormatVersion.cs
- IndexedGlyphRun.cs
- remotingproxy.cs
- WebPartUserCapability.cs
- nulltextnavigator.cs
- XPathConvert.cs
- __Error.cs
- ImpersonationContext.cs
- ToolStripPanelSelectionGlyph.cs
- DBDataPermission.cs
- ClientRoleProvider.cs
- ClrPerspective.cs
- PathTooLongException.cs
- DecimalKeyFrameCollection.cs
- AutomationPeer.cs
- EncoderParameters.cs
- TreeViewImageIndexConverter.cs
- AttachedPropertyBrowsableWhenAttributePresentAttribute.cs
- AbstractSvcMapFileLoader.cs
- ClickablePoint.cs
- SQLCharsStorage.cs
- Pointer.cs
- TdsParserStaticMethods.cs
- ObjectConverter.cs
- DbConnectionOptions.cs
- SafeUserTokenHandle.cs
- TimeoutConverter.cs
- arc.cs
- ProfilePropertySettings.cs
- TextServicesDisplayAttribute.cs
- MarkupExtensionSerializer.cs
- UnmanagedMemoryStreamWrapper.cs
- DictionaryGlobals.cs
- ExceptionUtil.cs
- Clipboard.cs
- PreloadedPackages.cs
- TdsParserSessionPool.cs
- EventMappingSettings.cs
- FormsAuthenticationModule.cs
- TrailingSpaceComparer.cs
- EmissiveMaterial.cs
- XmlAutoDetectWriter.cs
- FontFamilyConverter.cs
- XamlTreeBuilderBamlRecordWriter.cs
- LoginView.cs
- ToolboxItemAttribute.cs
- TextRange.cs
- listitem.cs
- StrongNameMembershipCondition.cs