Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / whidbey / NetFXspW7 / 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
- TreeNodeStyle.cs
- DuplicateWaitObjectException.cs
- ImportedNamespaceContextItem.cs
- ReferentialConstraint.cs
- DataServices.cs
- Stacktrace.cs
- GetPolicyDetailsRequest.cs
- SemaphoreFullException.cs
- IndexingContentUnit.cs
- SqlCacheDependency.cs
- BlurBitmapEffect.cs
- FrameworkTemplate.cs
- EventWaitHandle.cs
- ConstraintEnumerator.cs
- HScrollProperties.cs
- HotSpotCollection.cs
- SoapSchemaMember.cs
- AttributeCollection.cs
- CharacterString.cs
- XmlSchemaComplexType.cs
- ListViewItemSelectionChangedEvent.cs
- PropertyGridView.cs
- InputProcessorProfilesLoader.cs
- CodeTypeMember.cs
- DesignerDeviceConfig.cs
- FilterableAttribute.cs
- BasicExpressionVisitor.cs
- TextBoxAutomationPeer.cs
- RecognitionEventArgs.cs
- CurrencyManager.cs
- Parser.cs
- RelationshipFixer.cs
- ProgressBarRenderer.cs
- RepeatButtonAutomationPeer.cs
- NetworkInterface.cs
- SlipBehavior.cs
- unitconverter.cs
- FusionWrap.cs
- Maps.cs
- DbParameterCollection.cs
- XmlDictionaryReader.cs
- ImageFormatConverter.cs
- MediaElement.cs
- Memoizer.cs
- NotificationContext.cs
- HtmlInputPassword.cs
- SQLByte.cs
- SqlCommandSet.cs
- EpmHelper.cs
- XmlIgnoreAttribute.cs
- Size3D.cs
- BinaryParser.cs
- HttpChannelBindingToken.cs
- Listen.cs
- BaseTemplateBuildProvider.cs
- ProviderIncompatibleException.cs
- LineBreak.cs
- DbModificationClause.cs
- SafeFileMappingHandle.cs
- RawTextInputReport.cs
- ManagedIStream.cs
- TemplateControlParser.cs
- HtmlElementEventArgs.cs
- FlowDocumentPageViewerAutomationPeer.cs
- MenuItemStyleCollection.cs
- MenuTracker.cs
- HttpClientProtocol.cs
- ColumnMapProcessor.cs
- BindingManagerDataErrorEventArgs.cs
- ExtendedTransformFactory.cs
- CompiledRegexRunnerFactory.cs
- DynamicValidatorEventArgs.cs
- PEFileReader.cs
- OpenTypeCommon.cs
- DivideByZeroException.cs
- RolePrincipal.cs
- PointHitTestParameters.cs
- Shape.cs
- DataGridView.cs
- AsymmetricSignatureFormatter.cs
- HttpException.cs
- MailAddress.cs
- EncoderReplacementFallback.cs
- WebControlAdapter.cs
- LicenseManager.cs
- CurrencyWrapper.cs
- CodeSnippetCompileUnit.cs
- AttributeUsageAttribute.cs
- PrefixHandle.cs
- HtmlAnchor.cs
- CharKeyFrameCollection.cs
- WizardPanelChangingEventArgs.cs
- XPathItem.cs
- PropertyValueChangedEvent.cs
- Matrix.cs
- OleDbError.cs
- EventLogPermission.cs
- ReferenceConverter.cs
- TaiwanCalendar.cs
- SystemBrushes.cs