docs.unity3d.com
    Show / Hide Table of Contents

    Class TypeUtility

    Inheritance
    Object
    TypeUtility
    Namespace: Unity.VisualScripting
    Syntax
    public static class TypeUtility

    Methods

    AndBaseTypeAndInterfaces(Type)

    Declaration
    public static IEnumerable<Type> AndBaseTypeAndInterfaces(this Type type)
    Parameters
    Type Name Description
    Type type
    Returns
    Type Description
    IEnumerable<Type>

    AndHierarchy(Type)

    Declaration
    public static IEnumerable<Type> AndHierarchy(this Type type)
    Parameters
    Type Name Description
    Type type
    Returns
    Type Description
    IEnumerable<Type>

    AndInterfaces(Type)

    Declaration
    public static IEnumerable<Type> AndInterfaces(this Type type)
    Parameters
    Type Name Description
    Type type
    Returns
    Type Description
    IEnumerable<Type>

    BaseTypeAndInterfaces(Type, Boolean)

    Declaration
    public static IEnumerable<Type> BaseTypeAndInterfaces(this Type type, bool inheritedInterfaces = true)
    Parameters
    Type Name Description
    Type type
    Boolean inheritedInterfaces
    Returns
    Type Description
    IEnumerable<Type>

    CanMakeGenericTypeVia(Type, Type)

    Declaration
    public static bool CanMakeGenericTypeVia(this Type openConstructedType, Type closedConstructedType)
    Parameters
    Type Name Description
    Type openConstructedType
    Type closedConstructedType
    Returns
    Type Description
    Boolean

    Default(Type)

    Declaration
    public static object Default(this Type type)
    Parameters
    Type Name Description
    Type type
    Returns
    Type Description
    Object

    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
    Type Description
    Type

    GetDictionaryKeyType(Type, Boolean)

    Declaration
    public static Type GetDictionaryKeyType(Type dictionaryType, bool allowNonGeneric)
    Parameters
    Type Name Description
    Type dictionaryType
    Boolean allowNonGeneric
    Returns
    Type Description
    Type

    GetDictionaryValueType(Type, Boolean)

    Declaration
    public static Type GetDictionaryValueType(Type dictionaryType, bool allowNonGeneric)
    Parameters
    Type Name Description
    Type dictionaryType
    Boolean allowNonGeneric
    Returns
    Type Description
    Type

    GetEnumerableElementType(Type, Boolean)

    Declaration
    public static Type GetEnumerableElementType(Type enumerableType, bool allowNonGeneric)
    Parameters
    Type Name Description
    Type enumerableType
    Boolean allowNonGeneric
    Returns
    Type Description
    Type

    GetInterfaces(Type, Boolean)

    Declaration
    public static IEnumerable<Type> GetInterfaces(this Type type, bool includeInherited)
    Parameters
    Type Name Description
    Type type
    Boolean includeInherited
    Returns
    Type Description
    IEnumerable<Type>

    GetListElementType(Type, Boolean)

    Declaration
    public static Type GetListElementType(Type listType, bool allowNonGeneric)
    Parameters
    Type Name Description
    Type listType
    Boolean allowNonGeneric
    Returns
    Type Description
    Type

    GetTypesSafely(Assembly)

    Declaration
    public static IEnumerable<Type> GetTypesSafely(this Assembly assembly)
    Parameters
    Type Name Description
    Assembly assembly
    Returns
    Type Description
    IEnumerable<Type>

    Hierarchy(Type)

    Declaration
    public static IEnumerable<Type> Hierarchy(this Type type)
    Parameters
    Type Name Description
    Type type
    Returns
    Type Description
    IEnumerable<Type>

    Instantiate(Type, Boolean, Object[])

    Declaration
    public static object Instantiate(this Type type, bool nonPublic = true, params object[] args)
    Parameters
    Type Name Description
    Type type
    Boolean nonPublic
    Object[] args
    Returns
    Type Description
    Object

    Instantiator(Type, Boolean)

    Declaration
    public static Func<object> Instantiator(this Type type, bool nonPublic = true)
    Parameters
    Type Name Description
    Type type
    Boolean nonPublic
    Returns
    Type Description
    Func<Object>

    Instantiator(Type, Boolean, Type[])

    Declaration
    public static Func<object[], object> Instantiator(this Type type, bool nonPublic = true, params Type[] parameterTypes)
    Parameters
    Type Name Description
    Type type
    Boolean nonPublic
    Type[] parameterTypes
    Returns
    Type Description
    Func<Object[], Object>

    IsAbstract(Type)

    Declaration
    public static bool IsAbstract(this Type type)
    Parameters
    Type Name Description
    Type type
    Returns
    Type Description
    Boolean

    IsAssignableFrom(Type, Object)

    Declaration
    public static bool IsAssignableFrom(this Type type, object value)
    Parameters
    Type Name Description
    Type type
    Object value
    Returns
    Type Description
    Boolean

    IsBasic(Type)

    Declaration
    public static bool IsBasic(this Type type)
    Parameters
    Type Name Description
    Type type
    Returns
    Type Description
    Boolean

    IsConcrete(Type)

    Declaration
    public static bool IsConcrete(this Type type)
    Parameters
    Type Name Description
    Type type
    Returns
    Type Description
    Boolean

    IsNullable(Type)

    Declaration
    public static bool IsNullable(this Type type)
    Parameters
    Type Name Description
    Type type
    Returns
    Type Description
    Boolean

    IsNumeric(Type)

    Declaration
    public static bool IsNumeric(this Type type)
    Parameters
    Type Name Description
    Type type
    Returns
    Type Description
    Boolean

    IsNumericConstruct(Type)

    Declaration
    public static bool IsNumericConstruct(this Type type)
    Parameters
    Type Name Description
    Type type
    Returns
    Type Description
    Boolean

    IsReferenceType(Type)

    Declaration
    public static bool IsReferenceType(this Type type)
    Parameters
    Type Name Description
    Type type
    Returns
    Type Description
    Boolean

    IsStatic(Type)

    Declaration
    public static bool IsStatic(this Type type)
    Parameters
    Type Name Description
    Type type
    Returns
    Type Description
    Boolean

    IsStruct(Type)

    Declaration
    public static bool IsStruct(this Type type)
    Parameters
    Type Name Description
    Type type
    Returns
    Type Description
    Boolean

    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
    Type Name Description
    Type openConstructedType
    Type closedConstructedType
    Dictionary<Type, Type> resolvedGenericParameters
    Boolean safe
    Returns
    Type Description
    Type

    Namespace(Type)

    Declaration
    public static Namespace Namespace(this Type type)
    Parameters
    Type Name Description
    Type type
    Returns
    Type Description
    Namespace

    PseudoDefault(Type)

    Declaration
    public static object PseudoDefault(this Type type)
    Parameters
    Type Name Description
    Type type
    Returns
    Type Description
    Object

    ToShortString(Object, Int32)

    Declaration
    public static string ToShortString(this object o, int maxLength = 20)
    Parameters
    Type Name Description
    Object o
    Int32 maxLength
    Returns
    Type Description
    String

    TryInstantiate(Type, Boolean, Object[])

    Declaration
    public static object TryInstantiate(this Type type, bool nonPublic = true, params object[] args)
    Parameters
    Type Name Description
    Type type
    Boolean nonPublic
    Object[] args
    Returns
    Type Description
    Object
    In This Article
    • Methods
      • AndBaseTypeAndInterfaces(Type)
      • AndHierarchy(Type)
      • AndInterfaces(Type)
      • BaseTypeAndInterfaces(Type, Boolean)
      • CanMakeGenericTypeVia(Type, Type)
      • Default(Type)
      • GetDictionaryItemType(Type, Boolean, Int32)
      • GetDictionaryKeyType(Type, Boolean)
      • GetDictionaryValueType(Type, Boolean)
      • GetEnumerableElementType(Type, Boolean)
      • GetInterfaces(Type, Boolean)
      • GetListElementType(Type, Boolean)
      • GetTypesSafely(Assembly)
      • Hierarchy(Type)
      • Instantiate(Type, Boolean, Object[])
      • Instantiator(Type, Boolean)
      • Instantiator(Type, Boolean, Type[])
      • IsAbstract(Type)
      • IsAssignableFrom(Type, Object)
      • IsBasic(Type)
      • IsConcrete(Type)
      • IsNullable(Type)
      • IsNumeric(Type)
      • IsNumericConstruct(Type)
      • IsReferenceType(Type)
      • IsStatic(Type)
      • IsStruct(Type)
      • MakeGenericTypeVia(Type, Type, Dictionary<Type, Type>, Boolean)
      • Namespace(Type)
      • PseudoDefault(Type)
      • ToShortString(Object, Int32)
      • TryInstantiate(Type, Boolean, Object[])
    Back to top
    Copyright © 2023 Unity Technologies — Terms of use
    • Legal
    • Privacy Policy
    • Cookies
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)
    "Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
    Generated by DocFX on 18 October 2023