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
- Completion.cs
- AsymmetricSignatureFormatter.cs
- TileBrush.cs
- UnionExpr.cs
- KeyEvent.cs
- LoginCancelEventArgs.cs
- SortQuery.cs
- SafeEventLogReadHandle.cs
- LifetimeServices.cs
- Internal.cs
- TraceRecord.cs
- DataObjectPastingEventArgs.cs
- PagedControl.cs
- SqlServices.cs
- PersistenceParticipant.cs
- UInt32Storage.cs
- FormClosedEvent.cs
- SystemColors.cs
- StickyNoteAnnotations.cs
- EdmItemCollection.OcAssemblyCache.cs
- TableColumnCollection.cs
- SafeCoTaskMem.cs
- BitStack.cs
- CapiSafeHandles.cs
- InvalidAsynchronousStateException.cs
- SafeRightsManagementHandle.cs
- Point3DAnimation.cs
- XamlBrushSerializer.cs
- RequestCacheEntry.cs
- HeaderedContentControl.cs
- PartialList.cs
- ItemTypeToolStripMenuItem.cs
- GeometryCollection.cs
- RealizationDrawingContextWalker.cs
- RenderContext.cs
- SelectionRangeConverter.cs
- UnsafeNativeMethodsPenimc.cs
- autovalidator.cs
- OpenFileDialog.cs
- SafeCryptHandles.cs
- SystemThemeKey.cs
- WebServiceFaultDesigner.cs
- WorkflowMarkupSerializationException.cs
- ToolStripPanel.cs
- WebEventCodes.cs
- ToolStripTemplateNode.cs
- BamlBinaryWriter.cs
- RoutingBehavior.cs
- InvalidPrinterException.cs
- ConnectionManagementSection.cs
- TemplatePagerField.cs
- MD5HashHelper.cs
- MD5CryptoServiceProvider.cs
- Delegate.cs
- AbstractExpressions.cs
- IMembershipProvider.cs
- Validator.cs
- OLEDB_Enum.cs
- OutOfProcStateClientManager.cs
- LinqExpressionNormalizer.cs
- ConstructorNeedsTagAttribute.cs
- WindowCollection.cs
- DesignerForm.cs
- RuntimeEnvironment.cs
- ResourceIDHelper.cs
- FilteredAttributeCollection.cs
- UnsafeNativeMethods.cs
- SpeechDetectedEventArgs.cs
- ColumnTypeConverter.cs
- EmptyQuery.cs
- TogglePattern.cs
- ContextStack.cs
- Win32Interop.cs
- EventTask.cs
- DataSourceXmlSubItemAttribute.cs
- NullRuntimeConfig.cs
- FormsIdentity.cs
- PreviewKeyDownEventArgs.cs
- RoleGroup.cs
- LoginName.cs
- DbDataRecord.cs
- DefaultSection.cs
- CacheChildrenQuery.cs
- SequentialUshortCollection.cs
- MouseButtonEventArgs.cs
- AjaxFrameworkAssemblyAttribute.cs
- DynamicPropertyHolder.cs
- SqlFacetAttribute.cs
- PathStreamGeometryContext.cs
- GetIndexBinder.cs
- NullEntityWrapper.cs
- EncoderNLS.cs
- ControlAdapter.cs
- UserControlAutomationPeer.cs
- ShaderEffect.cs
- SHA256Managed.cs
- PassportAuthentication.cs
- OuterGlowBitmapEffect.cs
- BasicExpressionVisitor.cs
- PersonalizationAdministration.cs