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
- AutomationPropertyInfo.cs
- NeutralResourcesLanguageAttribute.cs
- SecurityException.cs
- TextEmbeddedObject.cs
- Group.cs
- RequestCacheEntry.cs
- VisualStyleElement.cs
- DataPagerFieldCollection.cs
- MergePropertyDescriptor.cs
- DynamicDataResources.Designer.cs
- QilInvoke.cs
- LicenseContext.cs
- invalidudtexception.cs
- ViewCellSlot.cs
- AppModelKnownContentFactory.cs
- RoutedEventValueSerializer.cs
- ListItemsPage.cs
- FieldToken.cs
- _TimerThread.cs
- MasterPageCodeDomTreeGenerator.cs
- LOSFormatter.cs
- DesignerDataSourceView.cs
- MLangCodePageEncoding.cs
- BamlLocalizableResourceKey.cs
- ControllableStoryboardAction.cs
- CodeChecksumPragma.cs
- DataException.cs
- SqlConnectionHelper.cs
- ServiceOperationParameter.cs
- QueryTaskGroupState.cs
- DataService.cs
- FieldNameLookup.cs
- DynamicDataRoute.cs
- SynchronizedDispatch.cs
- RangeValidator.cs
- CacheOutputQuery.cs
- CodeCastExpression.cs
- DataGridRowHeader.cs
- XPathParser.cs
- AccessViolationException.cs
- BaseCodeDomTreeGenerator.cs
- DiagnosticStrings.cs
- DataTableReader.cs
- ToolStripItemCollection.cs
- Floater.cs
- BindingGroup.cs
- PartManifestEntry.cs
- Inline.cs
- WebPartConnectionCollection.cs
- basevalidator.cs
- Effect.cs
- ConstantProjectedSlot.cs
- SimpleWebHandlerParser.cs
- PathGeometry.cs
- SqlConnectionPoolGroupProviderInfo.cs
- AutomationPatternInfo.cs
- MetadataArtifactLoaderCompositeFile.cs
- DiscoveryDocumentReference.cs
- ControlBuilder.cs
- UTF7Encoding.cs
- ExportFileRequest.cs
- QueryResponse.cs
- CustomTokenProvider.cs
- PropertyInfoSet.cs
- AudioLevelUpdatedEventArgs.cs
- ProfileServiceManager.cs
- CdpEqualityComparer.cs
- GCHandleCookieTable.cs
- FontResourceCache.cs
- CodeIdentifier.cs
- ViewBase.cs
- TextElementAutomationPeer.cs
- MetadataUtilsSmi.cs
- SqlRecordBuffer.cs
- ConfigXmlDocument.cs
- DocumentOrderComparer.cs
- IntSecurity.cs
- XmlTextAttribute.cs
- KeyToListMap.cs
- COM2ComponentEditor.cs
- SystemTcpConnection.cs
- RegistryHandle.cs
- MenuEventArgs.cs
- DbConnectionStringBuilder.cs
- Geometry.cs
- Condition.cs
- Int32AnimationBase.cs
- CharacterMetricsDictionary.cs
- Ref.cs
- EntryWrittenEventArgs.cs
- TransformerTypeCollection.cs
- FileVersion.cs
- NumericPagerField.cs
- BaseTemplateBuildProvider.cs
- ResourceReferenceKeyNotFoundException.cs
- TagPrefixCollection.cs
- CryptoHelper.cs
- WebPartDescriptionCollection.cs
- JapaneseCalendar.cs
- ObjectViewQueryResultData.cs