Quantum 3 3.0.6

Static Public Member Functions | List of all members
Quantum.TypeUtils Class Reference

Type reflection utility methods. Is generally slow. More...

Static Public Member Functions

static Type FindType (string typeName)
 Find a type by a given name inside all loaded assemblies. More...
 
static T GetAttribute< T > (this Type t)
 Get an attribute from the type. More...
 
static IEnumerable< Type > GetLoadableTypes (this Assembly assembly)
 Get a list of all types inside a given assembly. More...
 
static IEnumerable< Type > GetSubClasses (this Type type, Assembly asm)
 Get all types that are subclasses to the given type found inside the assembly. More...
 
static IEnumerable< Type > GetSubClasses (this Type type, params Assembly[] assemblies)
 Get all types that are subclasses to the given type found inside the given assemblies. More...
 
static IEnumerable< Type > GetSubClasses (this Type type, params String[] assemblies)
 Get all types that are subclasses to the given type found inside the given assembly names. More...
 
static IEnumerable< Type > GetTypesImplementingInterface (this Type type, Assembly asm)
 Get all types that are implementing the given interface found inside the assembly. More...
 
static IEnumerable< QTuple< Type, T > > GetTypesWithAttribute< T > (Assembly asm)
 Get all types annotated with the given attribute found inside the given assembly. More...
 
static IEnumerable< QTuple< Type, T > > GetTypesWithAttribute< T > (params String[] assemblies)
 Get all types annotated with the given attribute found inside the given assembly names. More...
 

Detailed Description

Type reflection utility methods. Is generally slow.

Member Function Documentation

◆ GetSubClasses() [1/3]

static IEnumerable<Type> Quantum.TypeUtils.GetSubClasses ( this Type  type,
params String[]  assemblies 
)
inlinestatic

Get all types that are subclasses to the given type found inside the given assembly names.

Parameters
typeInput type
assembliesAssembly names to search
Returns
A list of types that derive from the input type

◆ GetSubClasses() [2/3]

static IEnumerable<Type> Quantum.TypeUtils.GetSubClasses ( this Type  type,
params Assembly[]  assemblies 
)
inlinestatic

Get all types that are subclasses to the given type found inside the given assemblies.

Parameters
typeInput type
assembliesAssemblies to search
Returns
A list of types that derive from the input type

◆ GetSubClasses() [3/3]

static IEnumerable<Type> Quantum.TypeUtils.GetSubClasses ( this Type  type,
Assembly  asm 
)
inlinestatic

Get all types that are subclasses to the given type found inside the assembly.

Parameters
typeInput type
asmAssembly to search
Returns
A list of types that derive from the input type

◆ GetTypesImplementingInterface()

static IEnumerable<Type> Quantum.TypeUtils.GetTypesImplementingInterface ( this Type  type,
Assembly  asm 
)
inlinestatic

Get all types that are implementing the given interface found inside the assembly.

Parameters
typeInterface type
asmAssembly to search
Returns
A list of types that derive from the input interface

◆ GetTypesWithAttribute< T >() [1/2]

static IEnumerable<QTuple<Type, T> > Quantum.TypeUtils.GetTypesWithAttribute< T > ( params String[]  assemblies)
inlinestatic

Get all types annotated with the given attribute found inside the given assembly names.

Template Parameters
TAttribute type
Parameters
assembliesAssemblies to search
Returns
A list of types with the given attribute
Type Constraints
T :Attribute 

◆ GetTypesWithAttribute< T >() [2/2]

static IEnumerable<QTuple<Type, T> > Quantum.TypeUtils.GetTypesWithAttribute< T > ( Assembly  asm)
inlinestatic

Get all types annotated with the given attribute found inside the given assembly.

Template Parameters
TAttribute type
Parameters
asmAssembly to search
Returns
A list of types with the given attribute
Type Constraints
T :Attribute 

◆ GetAttribute< T >()

static T Quantum.TypeUtils.GetAttribute< T > ( this Type  t)
inlinestatic

Get an attribute from the type.

Template Parameters
TAttribute type
Parameters
tType to check for the attribute
Returns
The attribute or null
Type Constraints
T :Attribute 

◆ FindType()

static Type Quantum.TypeUtils.FindType ( string  typeName)
inlinestatic

Find a type by a given name inside all loaded assemblies.

Parameters
typeNameType name
Returns
The type or null when not found

◆ GetLoadableTypes()

static IEnumerable<Type> Quantum.TypeUtils.GetLoadableTypes ( this Assembly  assembly)
inlinestatic

Get a list of all types inside a given assembly.

Parameters
assemblyAssembly to search
Returns
A list of all types from that assembly
Exceptions
ArgumentNullExceptionIs raised if the assembly is null