Class AssemblyEx
Class containing some extension methods for System.Reflection.Assembly.
Inheritance
Inherited Members
Namespace:Extend
Assembly:Extend.dll
Syntax
public static class AssemblyEx
Methods
| Improve this Doc View SourceGetTypesWithAttribute<T>(Boolean, Assembly[])
Gets all types of the given assemblies which is decorated with an attribute of the specified type.
Declaration
public static IEnumerable<IAttributeDefinitionType<T>> GetTypesWithAttribute<T>(bool inherit, params Assembly[] assemblies)where T : Attribute
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | inherit | true to search this member's inheritance chain to find the attributes; otherwise, false. This parameter is ignored for properties and events; see Remarks. |
System.Reflection.Assembly[] | assemblies | The assemblies to search in. |
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<T><IAttributeDefinitionType<T><T>> | Returns the found types and their attributes. |
Type Parameters
Name | Description |
---|---|
T | The type of the attribute. |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | assemblies can not be null. |
GetTypesWithAttribute<T>(Boolean, Type, Assembly[])
Gets all types of the given assemblies which is decorated with an attribute of the specified type and are sub classes of the specified base type.
Declaration
public static IEnumerable<IAttributeDefinitionType<T>> GetTypesWithAttribute<T>(bool inherit, Type baseType, params Assembly[] assemblies)where T : Attribute
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | inherit | true to search this member's inheritance chain to find the attributes; otherwise, false. This parameter is ignored for properties and events; see Remarks. |
System.Type | baseType | The base type to search for, or null. |
System.Reflection.Assembly[] | assemblies | The assemblies to search in. |
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<T><IAttributeDefinitionType<T><T>> | Returns the found types and their attributes. |
Type Parameters
Name | Description |
---|---|
T | The type of the attribute. |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | assemblies can not be null. |
GetTypesWithAttribute<T>(Assembly[])
Gets all types of the given assemblies which is decorated with an attribute of the specified type.
Declaration
public static IEnumerable<IAttributeDefinitionType<T>> GetTypesWithAttribute<T>(params Assembly[] assemblies)where T : Attribute
Parameters
Type | Name | Description |
---|---|---|
System.Reflection.Assembly[] | assemblies | The assemblies to search in. |
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<T><IAttributeDefinitionType<T><T>> | Returns the found types and their attributes. |
Type Parameters
Name | Description |
---|---|
T | The type of the attribute. |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | assemblies can not be null. |