Class TypeUtility
Syntax
public static class TypeUtility
Methods
AndBaseTypeAndInterfaces(Type)
Declaration
public static IEnumerable<Type> AndBaseTypeAndInterfaces(this Type type)
Parameters
Type |
Name |
Description |
Type |
type |
|
Returns
AndHierarchy(Type)
Declaration
public static IEnumerable<Type> AndHierarchy(this Type type)
Parameters
Type |
Name |
Description |
Type |
type |
|
Returns
AndInterfaces(Type)
Declaration
public static IEnumerable<Type> AndInterfaces(this Type type)
Parameters
Type |
Name |
Description |
Type |
type |
|
Returns
BaseTypeAndInterfaces(Type, Boolean)
Declaration
public static IEnumerable<Type> BaseTypeAndInterfaces(this Type type, bool inheritedInterfaces = true)
Parameters
Type |
Name |
Description |
Type |
type |
|
Boolean |
inheritedInterfaces |
|
Returns
CanMakeGenericTypeVia(Type, Type)
Declaration
public static bool CanMakeGenericTypeVia(this Type openConstructedType, Type closedConstructedType)
Parameters
Type |
Name |
Description |
Type |
openConstructedType |
|
Type |
closedConstructedType |
|
Returns
Default(Type)
Declaration
public static object Default(this Type type)
Parameters
Type |
Name |
Description |
Type |
type |
|
Returns
GetDictionaryItemType(Type, Boolean, Int32)
Declaration
public static Type GetDictionaryItemType(Type dictionaryType, bool allowNonGeneric, int genericArgumentIndex)
Parameters
Type |
Name |
Description |
Type |
dictionaryType |
|
Boolean |
allowNonGeneric |
|
Int32 |
genericArgumentIndex |
|
Returns
GetDictionaryKeyType(Type, Boolean)
Declaration
public static Type GetDictionaryKeyType(Type dictionaryType, bool allowNonGeneric)
Parameters
Type |
Name |
Description |
Type |
dictionaryType |
|
Boolean |
allowNonGeneric |
|
Returns
GetDictionaryValueType(Type, Boolean)
Declaration
public static Type GetDictionaryValueType(Type dictionaryType, bool allowNonGeneric)
Parameters
Type |
Name |
Description |
Type |
dictionaryType |
|
Boolean |
allowNonGeneric |
|
Returns
GetEnumerableElementType(Type, Boolean)
Declaration
public static Type GetEnumerableElementType(Type enumerableType, bool allowNonGeneric)
Parameters
Type |
Name |
Description |
Type |
enumerableType |
|
Boolean |
allowNonGeneric |
|
Returns
GetInterfaces(Type, Boolean)
Declaration
public static IEnumerable<Type> GetInterfaces(this Type type, bool includeInherited)
Parameters
Type |
Name |
Description |
Type |
type |
|
Boolean |
includeInherited |
|
Returns
GetListElementType(Type, Boolean)
Declaration
public static Type GetListElementType(Type listType, bool allowNonGeneric)
Parameters
Type |
Name |
Description |
Type |
listType |
|
Boolean |
allowNonGeneric |
|
Returns
GetTypesSafely(Assembly)
Declaration
public static IEnumerable<Type> GetTypesSafely(this Assembly assembly)
Parameters
Returns
Hierarchy(Type)
Declaration
public static IEnumerable<Type> Hierarchy(this Type type)
Parameters
Type |
Name |
Description |
Type |
type |
|
Returns
Instantiate(Type, Boolean, Object[])
Declaration
public static object Instantiate(this Type type, bool nonPublic = true, params object[] args)
Parameters
Returns
Instantiator(Type, Boolean)
Declaration
public static Func<object> Instantiator(this Type type, bool nonPublic = true)
Parameters
Returns
Instantiator(Type, Boolean, Type[])
Declaration
public static Func<object[], object> Instantiator(this Type type, bool nonPublic = true, params Type[] parameterTypes)
Parameters
Returns
IsAbstract(Type)
Declaration
public static bool IsAbstract(this Type type)
Parameters
Type |
Name |
Description |
Type |
type |
|
Returns
IsAssignableFrom(Type, Object)
Declaration
public static bool IsAssignableFrom(this Type type, object value)
Parameters
Returns
IsBasic(Type)
Declaration
public static bool IsBasic(this Type type)
Parameters
Type |
Name |
Description |
Type |
type |
|
Returns
IsConcrete(Type)
Declaration
public static bool IsConcrete(this Type type)
Parameters
Type |
Name |
Description |
Type |
type |
|
Returns
IsNullable(Type)
Declaration
public static bool IsNullable(this Type type)
Parameters
Type |
Name |
Description |
Type |
type |
|
Returns
IsNumeric(Type)
Declaration
public static bool IsNumeric(this Type type)
Parameters
Type |
Name |
Description |
Type |
type |
|
Returns
IsNumericConstruct(Type)
Declaration
public static bool IsNumericConstruct(this Type type)
Parameters
Type |
Name |
Description |
Type |
type |
|
Returns
IsReferenceType(Type)
Declaration
public static bool IsReferenceType(this Type type)
Parameters
Type |
Name |
Description |
Type |
type |
|
Returns
IsStatic(Type)
Declaration
public static bool IsStatic(this Type type)
Parameters
Type |
Name |
Description |
Type |
type |
|
Returns
IsStruct(Type)
Declaration
public static bool IsStruct(this Type type)
Parameters
Type |
Name |
Description |
Type |
type |
|
Returns
MakeGenericTypeVia(Type, Type, Dictionary<Type, Type>, Boolean)
Declaration
public static Type MakeGenericTypeVia(this Type openConstructedType, Type closedConstructedType, Dictionary<Type, Type> resolvedGenericParameters, bool safe = true)
Parameters
Returns
Namespace(Type)
Declaration
public static Namespace Namespace(this Type type)
Parameters
Type |
Name |
Description |
Type |
type |
|
Returns
PseudoDefault(Type)
Declaration
public static object PseudoDefault(this Type type)
Parameters
Type |
Name |
Description |
Type |
type |
|
Returns
ToShortString(Object, Int32)
Declaration
public static string ToShortString(this object o, int maxLength = 20)
Parameters
Returns
TryInstantiate(Type, Boolean, Object[])
Declaration
public static object TryInstantiate(this Type type, bool nonPublic = true, params object[] args)
Parameters
Returns