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
- OracleInfoMessageEventArgs.cs
- DirectoryRootQuery.cs
- Parameter.cs
- PropertyDescriptorGridEntry.cs
- FragmentQueryKB.cs
- ExceptionUtil.cs
- ZipIOLocalFileHeader.cs
- ServiceTimeoutsElement.cs
- MachineKeyConverter.cs
- MasterPageParser.cs
- HtmlShimManager.cs
- MenuItemAutomationPeer.cs
- XamlSerializerUtil.cs
- ClientFormsIdentity.cs
- WmfPlaceableFileHeader.cs
- Guid.cs
- SmiMetaData.cs
- XmlDocumentFieldSchema.cs
- ToolStripDropDownClosedEventArgs.cs
- FullTextBreakpoint.cs
- NameNode.cs
- CheckBox.cs
- ListParagraph.cs
- SetterTriggerConditionValueConverter.cs
- IntSecurity.cs
- InfoCardBaseException.cs
- DataControlFieldHeaderCell.cs
- WebPartDisplayModeCancelEventArgs.cs
- StyleSheet.cs
- ExpandCollapseProviderWrapper.cs
- TreeViewHitTestInfo.cs
- ItemCheckedEvent.cs
- EntityChangedParams.cs
- EventHandlerList.cs
- ListDictionaryInternal.cs
- DefaultBindingPropertyAttribute.cs
- JsonUriDataContract.cs
- RuntimeConfig.cs
- ClosableStream.cs
- Opcode.cs
- ConfigurationManagerHelperFactory.cs
- IntSecurity.cs
- CellTreeNodeVisitors.cs
- LinqDataSourceView.cs
- PathStreamGeometryContext.cs
- XmlLangPropertyAttribute.cs
- FrameSecurityDescriptor.cs
- FileLogRecordHeader.cs
- RoleService.cs
- CallbackHandler.cs
- CaseInsensitiveOrdinalStringComparer.cs
- ValidateNames.cs
- DesignTimeVisibleAttribute.cs
- Executor.cs
- DbMetaDataCollectionNames.cs
- PackUriHelper.cs
- WindowsFormsHostAutomationPeer.cs
- DragEvent.cs
- ShapingEngine.cs
- FileUtil.cs
- DynamicActivityProperty.cs
- ThreadStartException.cs
- TextRunTypographyProperties.cs
- PrintDialog.cs
- SqlServices.cs
- RequestQueue.cs
- DbConnectionPool.cs
- DataGridColumn.cs
- ScriptResourceHandler.cs
- COM2ComponentEditor.cs
- HttpsTransportBindingElement.cs
- SafeRegistryHandle.cs
- HtmlShimManager.cs
- ModelUIElement3D.cs
- TextTreeInsertUndoUnit.cs
- ObjectSpanRewriter.cs
- TraceSwitch.cs
- SqlDataAdapter.cs
- AsyncStreamReader.cs
- SafeNativeMethodsMilCoreApi.cs
- ActivationServices.cs
- CallbackValidator.cs
- OpacityConverter.cs
- FontFamily.cs
- HashCryptoHandle.cs
- XmlLangPropertyAttribute.cs
- ServiceDebugBehavior.cs
- Bezier.cs
- TextProperties.cs
- PerformanceCounter.cs
- PersistStreamTypeWrapper.cs
- rsa.cs
- RoutedPropertyChangedEventArgs.cs
- InvalidOperationException.cs
- TransactionsSectionGroup.cs
- SafeArchiveContext.cs
- KeyConverter.cs
- VectorAnimation.cs
- safelinkcollection.cs
- SynchronizationScope.cs