Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / whidbey / netfxsp / 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
- NamespaceCollection.cs
- SynchronizedDispatch.cs
- InstanceHandle.cs
- PropertyValueEditor.cs
- FrameworkElementFactoryMarkupObject.cs
- StringValueSerializer.cs
- ContainerVisual.cs
- ClientScriptManager.cs
- MainMenu.cs
- ToolBarOverflowPanel.cs
- XmlNamedNodeMap.cs
- ObfuscationAttribute.cs
- StreamResourceInfo.cs
- SpeakCompletedEventArgs.cs
- PerspectiveCamera.cs
- ListBox.cs
- BinaryWriter.cs
- XDeferredAxisSource.cs
- WeakReferenceKey.cs
- X509UI.cs
- GridPatternIdentifiers.cs
- FunctionUpdateCommand.cs
- XmlSchemaObjectTable.cs
- ParserExtension.cs
- ReadOnlyObservableCollection.cs
- PreviousTrackingServiceAttribute.cs
- bindurihelper.cs
- MarkupCompiler.cs
- DataGridViewColumn.cs
- GatewayDefinition.cs
- PropertySourceInfo.cs
- BackgroundFormatInfo.cs
- DataServiceClientException.cs
- TogglePattern.cs
- StatusStrip.cs
- DiscoveryDocumentSearchPattern.cs
- CookielessHelper.cs
- RSAPKCS1KeyExchangeDeformatter.cs
- ProgressBarHighlightConverter.cs
- ModelUIElement3D.cs
- TextEditorMouse.cs
- PageThemeParser.cs
- SelectionChangedEventArgs.cs
- MutexSecurity.cs
- PrincipalPermission.cs
- ConnectionPoolManager.cs
- TextProperties.cs
- EventLogTraceListener.cs
- TypeResolvingOptionsAttribute.cs
- GenerateTemporaryTargetAssembly.cs
- SetterBaseCollection.cs
- ParallelForEach.cs
- NotifyParentPropertyAttribute.cs
- RewritingSimplifier.cs
- DetailsViewRow.cs
- BinaryCommonClasses.cs
- BulletedListEventArgs.cs
- altserialization.cs
- ReadOnlyCollectionBase.cs
- KeyedQueue.cs
- _TimerThread.cs
- WindowsFormsHostAutomationPeer.cs
- SctClaimSerializer.cs
- ExecutedRoutedEventArgs.cs
- HwndSourceParameters.cs
- XmlSerializationReader.cs
- SocketAddress.cs
- IUnknownConstantAttribute.cs
- FontStretch.cs
- PrincipalPermission.cs
- NodeInfo.cs
- EventMappingSettings.cs
- NativeWindow.cs
- QilTargetType.cs
- QueryExtender.cs
- DataBindingCollection.cs
- OutOfProcStateClientManager.cs
- Dispatcher.cs
- IgnorePropertiesAttribute.cs
- PointHitTestResult.cs
- RemotingClientProxy.cs
- ExtendedPropertyDescriptor.cs
- Timer.cs
- SQLChars.cs
- ClientCultureInfo.cs
- ChildTable.cs
- iisPickupDirectory.cs
- NotFiniteNumberException.cs
- NativeMethods.cs
- BookmarkUndoUnit.cs
- StructuredTypeEmitter.cs
- CookielessHelper.cs
- XmlNamespaceMappingCollection.cs
- TransactionInterop.cs
- CodeCommentStatementCollection.cs
- FlowDocumentFormatter.cs
- DeclarativeCatalogPart.cs
- BufferModesCollection.cs
- ComplexObject.cs
- RepeaterItem.cs