Skip to content

TypeEx

Inherits object

Public Static Functions

bool

IsAssignableTo(this Type sourceType, Type targetType)

bool

ImplementsInterface(this Type toCheck, Type interfaceType)

bool

IsOpenGeneric(this Type toCheck)

bool

InheritsOpenGeneric(this Type toCheck, Type generic)

bool

IsAssignableToGenericType(this Type givenType, Type genericType)

bool

IsAssignableToWithConversion(this Type fromType, Type toType)

bool

HasConversionOperatorTo(this Type fromType, Type toType)

T

Preconstruct(Action preconstructor, params object[] constructorParameters)

Creates a new object, but runs code on the instantiated object prior to the constructor. A new object of type T. This function should be used with extreme caution.

ConstructorInfo?

GetConstructor(this Type type, object?[] parameters)

ConstructorInfo?

GetConstructor(this Type type, BindingFlags bindingAttr, object?[] parameters)

string

GetSimpleName(this Type type)

bool

IsNumeric(this Type type)

bool

IsIntegral(this Type type)

bool

IsSignedIntegral(this Type type)

bool

IsUnsignedIntegral(this Type type)

bool

IsFloatingPoint(this Type type)

bool

IsNullable(this Type type)

T?

GetCustomAttribute(this Type type)

IEnumerable

GetMethodsWithAttribute(this Type type)

object?

InvokeStaticMethod(this Type type, string methodName, params object?[] parameters)

TResult

InvokeStaticMethod(this Type type, string methodName)

TResult

InvokeStaticMethod(this Type type, string methodName, T1 arg1)

bool

IsReferenceOrContainsReferences(this Type type)

bool

TryFindByName(string typeName, out Type type)

Private Functions

MethodInfo?

GetCachedStaticMethod(Type type, string methodName)

Private Attributes

Dictionary

INTERFACE_CACHE

ConcurrentDictionary

_invokeMethodCache