Class AssemblyExtensions
- Namespace
- DotEx.Reflections
- Assembly
- DotEx.dll
Extensions for Assembly.
public static class AssemblyExtensions
- Inheritance
-
AssemblyExtensions
- Inherited Members
Methods
GetDerivedTypes(Assembly, Type, bool)
Returns all derived types of the provided base type. Return abstract types if
allowAbstract is true.
public static IEnumerable<Type> GetDerivedTypes(this Assembly assembly, Type baseType, bool allowAbstract)
Parameters
assemblyAssemblyAssembly to search.
baseTypeTypeBase type to compare.
allowAbstractboolAllow abstract derived types.
Returns
- IEnumerable<Type>
Derived types of the base type.
GetDerivedTypes<T>(Assembly, bool)
Returns all derived types of the provided base type. Return abstract types if
allowAbstract is true.
public static IEnumerable<Type> GetDerivedTypes<T>(this Assembly assembly, bool allowAbstract)
Parameters
Returns
- IEnumerable<Type>
Derived types of the base type.
Type Parameters
TBase type to compare.
GetTypesAndAttributes(Assembly, Type, bool)
Returns all types and their respective attributes in the assembly annotated with the given attribute.
Return abstract types if allowAbstract is true.
public static IEnumerable<(Type Type, Attribute[] Attributes)> GetTypesAndAttributes(this Assembly assembly, Type attrType, bool allowAbstract = false)
Parameters
assemblyAssemblyAssembly to search.
attrTypeTypeAttribute to match.
allowAbstractboolAllow abstract types, false by default
Returns
- IEnumerable<(Type Type, Attribute[] Attributes)>
Types with the given attribute defined, together with their respective attributes.
GetTypesAndAttributes<T>(Assembly, bool)
Returns all types and their respective attributes in the assembly annotated with the given attribute.
Return abstract types if allowAbstract is true.
public static IEnumerable<(Type Type, T[] Attributes)> GetTypesAndAttributes<T>(this Assembly assembly, bool allowAbstract = false) where T : Attribute
Parameters
Returns
- IEnumerable<(Type Type, T[] Attributes)>
Types with the given attribute defined.
Type Parameters
TAttribute to match.
GetTypesWithAttribute(Assembly, Type, bool)
Returns all types in the assembly annotated with the given attribute. Return abstract
types if allowAbstract is true.
public static IEnumerable<Type> GetTypesWithAttribute(this Assembly assembly, Type attrType, bool allowAbstract = false)
Parameters
assemblyAssemblyAssembly to search.
attrTypeTypeAttribute to match.
allowAbstractboolAllow abstract types, false by default
Returns
- IEnumerable<Type>
Types with the given attribute defined.
GetTypesWithAttribute<T>(Assembly, bool)
Returns all types in the assembly annotated with the given attribute. Return abstract
types if allowAbstract is true.
public static IEnumerable<Type> GetTypesWithAttribute<T>(this Assembly assembly, bool allowAbstract = false) where T : Attribute
Parameters
Returns
- IEnumerable<Type>
Types with the given attribute defined.
Type Parameters
TAttribute to match.