Class

# TypeInfo

<div class="rst-class">

forsearch

</div>

Introspection

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

## Description

Gets information about a program's structure. It is an abstract class whose properties and functions describe all the attributes or members a datatype might have.

## Properties

<div class="rst-class">

table-centered_columns_3_and_4

</div>

| Name                                      | Type                               | Read-Only | Shared |
|-------------------------------------------|------------------------------------|-----------|--------|
| `BaseType<typeinfo.basetype>`             | TypeInfo                           | ✓         |        |
| `FullName<typeinfo.fullname>`             | `String</api/data_types/string>`   | ✓         |        |
| `HasElementType<typeinfo.haselementtype>` | `Boolean</api/data_types/boolean>` | ✓         |        |
| `IsArray<typeinfo.isarray>`               | `Boolean</api/data_types/boolean>` | ✓         |        |
| `IsClass<typeinfo.isclass>`               | `Boolean</api/data_types/boolean>` | ✓         |        |
| `IsEnum<typeinfo.isenum>`                 | `Boolean</api/data_types/boolean>` | ✓         |        |
| `IsInterface<typeinfo.isinterface>`       | `Boolean</api/data_types/boolean>` | ✓         |        |
| `IsPointer<typeinfo.ispointer>`           | `Boolean</api/data_types/boolean>` | ✓         |        |
| `IsPrimitive<typeinfo.isprimitive>`       | `Boolean</api/data_types/boolean>` | ✓         |        |
| `IsPrivate<typeinfo.isprivate>`           | `Boolean</api/data_types/boolean>` | ✓         |        |
| `IsProtected<typeinfo.isprotected>`       | `Boolean</api/data_types/boolean>` | ✓         |        |
| `IsPublic<typeinfo.ispublic>`             | `Boolean</api/data_types/boolean>` | ✓         |        |
| `IsValueType<typeinfo.isvaluetype>`       | `Boolean</api/data_types/boolean>` | ✓         |        |
| `Name<typeinfo.name>`                     | `String</api/data_types/string>`   | ✓         |        |

## Methods

<div class="rst-class">

table-centered_column_4

</div>

| Name                                        | Parameters    | Returns                                                          | Shared |
|---------------------------------------------|---------------|------------------------------------------------------------------|--------|
| `GetArrayRank<typeinfo.getarrayrank>`       |               | `Integer</api/data_types/integer>`                               |        |
| `GetAttributes<typeinfo.getattributes>`     |               | `AttributeInfo()</api/language/introspection/attributeinfo>`     |        |
| `GetConstructors<typeinfo.getconstructors>` |               | `ConstructorInfo()</api/language/introspection/constructorinfo>` |        |
| `GetElementType<typeinfo.getelementtype>`   |               | TypeInfo                                                         |        |
| `GetMethods<typeinfo.getmethods>`           |               | `MethodInfo()</api/language/introspection/methodinfo>`           |        |
| `GetProperties<typeinfo.getproperties>`     |               | `PropertyInfo()</api/language/introspection/propertyinfo>`       |        |
| `IsSubclassOf<typeinfo.issubclassof>`       | c As TypeInfo | `Boolean</api/data_types/boolean>`                               |        |

## Property descriptions

<div id="typeinfo.basetype">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

TypeInfo.BaseType

**BaseType** As **TypeInfo**

> Gets the parent <span class="title-ref">TypeInfo</span> object and allows you to navigate the type hierarchy from child to parent.
>
> This property is read-only.

<div id="typeinfo.fullname">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

TypeInfo.FullName

**FullName** As `String</api/data_types/string>`

> The full name of the item, including the module path. If two different classes in different modules have the same name, then the FullName property will differentiate them. It is a globally unique identifier for the datatype.
>
> This property is read-only.

<div id="typeinfo.haselementtype">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

TypeInfo.HasElementType

**HasElementType** As `Boolean</api/data_types/boolean>`

> Compound datatypes have their own attributes as well as an element type.
>
> This property is read-only.

<div id="typeinfo.isarray">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

TypeInfo.IsArray

**IsArray** As `Boolean</api/data_types/boolean>`

> `True</api/language/true>` if the datatype is an array.
>
> This property is read-only.

<div id="typeinfo.isclass">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

TypeInfo.IsClass

**IsClass** As `Boolean</api/data_types/boolean>`

> `True</api/language/true>` if the datatype represents a class.
>
> This property is read-only.

<div id="typeinfo.isenum">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

TypeInfo.IsEnum

**IsEnum** As `Boolean</api/data_types/boolean>`

> `True</api/language/true>` if the datatype represents an enumerated set of constants.
>
> This property is read-only.

<div id="typeinfo.isinterface">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

TypeInfo.IsInterface

**IsInterface** As `Boolean</api/data_types/boolean>`

> `True</api/language/true>` if the datatype represents a class interface.
>
> This property is read-only.

<div id="typeinfo.ispointer">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

TypeInfo.IsPointer

**IsPointer** As `Boolean</api/data_types/boolean>`

> `True</api/language/true>` if the datatype represents a `Ptr</api/data_types/additional_types/ptr>` or one of the other external pointer types.
>
> This property is read-only.

<div id="typeinfo.isprimitive">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

TypeInfo.IsPrimitive

**IsPrimitive** As `Boolean</api/data_types/boolean>`

> `True</api/language/true>` if the datatype represents one of the primitive data types, i.e., `Boolean</api/data_types/boolean>`, `String</api/data_types/string>`, `Color</api/data_types/color>`, and the numeric data types.
>
> This property is read-only.

<div id="typeinfo.isprivate">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

TypeInfo.IsPrivate

**IsPrivate** As `Boolean</api/data_types/boolean>`

> If `True</api/language/true>`, the item has Private scope.
>
> This property is read-only.
>
> The following example checks the IsPrivate property before taking an action.
>
> ``` xojo
> Var d As DateTime = DateTime.Now
>
> For Each prop As Introspection.PropertyInfo In Introspection.GetType(d).GetProperties
>   If prop.IsPrivate Then
>     ' take an action here..
>   End If
> Next
> ```

<div id="typeinfo.isprotected">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

TypeInfo.IsProtected

**IsProtected** As `Boolean</api/data_types/boolean>`

> Is `True</api/language/true>`, the item has Protected scope.
>
> This property is read-only.
>
> ``` xojo
> Var d As DateTime = DateTime.Now
>
> For Each prop As Introspection.PropertyInfo In Introspection.GetType(d).GetProperties
>   If prop.IsProtected Then
>     ' take an action here..
>   End If
> Next
> ```

<div id="typeinfo.ispublic">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

TypeInfo.IsPublic

**IsPublic** As `Boolean</api/data_types/boolean>`

> If `True</api/language/true>`, the item has Public scope.
>
> This property is read-only.
>
> This example checks the IsPublic property before taking an action.
>
> ``` xojo
> Var d As DateTime = DateTime.Now
>
> For Each prop As Introspection.PropertyInfo In Introspection.GetType(d).GetProperties
>   If prop.IsPublic Then
>     ' take an action here..
>   End If
> Next
> ```

<div id="typeinfo.isvaluetype">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

TypeInfo.IsValueType

**IsValueType** As `Boolean</api/data_types/boolean>`

> `True</api/language/true>` if the datatype represents a value type. Value types are those which are not references. Assignment copies the value itself, rather than a reference to a piece of data. Primitive, pointer, structure, and enum types are all value types.
>
> This property is read-only.

<div id="typeinfo.name">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

TypeInfo.Name

**Name** As `String</api/data_types/string>`

> The name of the item. This is only the class name. To get the full namespace path, use FullName instead.
>
> This property is read-only.
>
> This code gets the list of properties for the passed type instance.
>
> ``` xojo
> Var d As DateTime = DateTime.Now
>
> For Each prop As Introspection.PropertyInfo In Introspection.GetType(d).GetProperties
>   ListBox1.AddRow(prop.Name)
> Next
> ```

## Method descriptions

<div id="typeinfo.getarrayrank">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

TypeInfo.GetArrayRank

**GetArrayRank** As `Integer</api/data_types/integer>`

> Returns the number of dimensions of the item. GetArrayRank is valid only if IsArray is `True</api/language/true>`. If the datatype is not an array, then calling GetArrayRank will raise an exception.
>
> ``` xojo
> Var Scores(10,10) As String
> Var ScoresVariant As Variant = Scores
> Var ScoresType As Introspection.TypeInfo = Introspection.GetType(scoresVariant)
> Var Dimensions As Int32 = ScoresType.GetArrayRank()
> ```

<div id="typeinfo.getattributes">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

TypeInfo.GetAttributes

**GetAttributes** As `AttributeInfo()</api/language/introspection/attributeinfo>`

> Returns an array of `AttributeInfo</api/language/introspection/attributeinfo>` objects.
>
> The following gets the attributes of window1.
>
> ``` xojo
> Var myAttributes() As Introspection.AttributeInfo = Introspection.GetType(Window1).GetAttributes
> ```

<div id="typeinfo.getconstructors">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

TypeInfo.GetConstructors

**GetConstructors** As `ConstructorInfo()</api/language/introspection/constructorinfo>`

> Returns an array of `ConstructorInfo</api/language/introspection/constructorinfo>` about the datatype. If the <span class="title-ref">TypeInfo</span> represents a class, then the returned array will contain constructors. Otherwise, it will be empty.

<div id="typeinfo.getelementtype">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

TypeInfo.GetElementType

**GetElementType** As TypeInfo

> Returns the type of the element. GetElementType is valid only if the datatype has an element type, i.e., if HasElementType is `True</api/language/true>`. If the datatype does not have an element type, then calling GetElementType will raise an exception.

<div id="typeinfo.getmethods">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

TypeInfo.GetMethods

**GetMethods** As `MethodInfo()</api/language/introspection/methodinfo>`

> Returns an array of `MethodInfo</api/language/introspection/methodinfo>` instances.
>
> TypeInfo.GetMethods lists parent methods which are overridden, resulting in duplicates in the list when you call GetMethods on a subclass.

<div id="typeinfo.getproperties">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

TypeInfo.GetProperties

**GetProperties** As `PropertyInfo()</api/language/introspection/propertyinfo>`

> Returns an array of `PropertyInfo</api/language/introspection/propertyinfo>` instances.

<div id="typeinfo.issubclassof">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

TypeInfo.IsSubclassOf

**IsSubclassOf**(c As TypeInfo) As `Boolean</api/data_types/boolean>`

> Returns `True</api/language/true>` if the datatype is a subclass of the passed datatype.

## Notes

TypeInfo is part of the Introspection namespace (module) so you'll have to prefix it and refer to it as "Introspection.TypeInfo".

## Sample code

The following returns `PropertyInfo</api/language/introspection/propertyinfo>` and `MethodInfo</api/language/introspection/methodinfo>` arrays containing the properties and methods of the passed class instance.

``` xojo
Var d As DateTime = DateTime.Now
Var myProperties() As Introspection.PropertyInfo = Introspection.GetType(d).GetProperties
Var myMethods() As Introspection.MethodInfo = Introspection.GetType(d).GetMethods
' display the properties...
For Each prop As Introspection.PropertyInfo In myProperties
  ListBox1.AddRow(prop.Name)
Next
```

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

This example gets the `ConstructorInfo</api/language/introspection/constructorinfo>` for the `FolderItem</api/files/folderitem>` class and creates a new instance of a `FolderItem</api/files/folderitem>`.

``` xojo
Var ti As Introspection.TypeInfo = GetTypeInfo(FolderItem)
Var ci() As Introspection.ConstructorInfo = ti.GetConstructors
Var f As FolderItem
f = ci(0).Invoke
```

## Compatibility

|                       |     |
|-----------------------|-----|
| **Project Types**     | All |
| **Operating Systems** | All |

<div class="seealso">

`MemberInfo</api/language/introspection/memberinfo>` parent class; `Introspection</api/language/introspection/introspection>` module; `AttributeInfo</api/language/introspection/attributeinfo>`, `ConstructorInfo</api/language/introspection/constructorinfo>`, `MemberInfo</api/language/introspection/memberinfo>`, `MethodInfo</api/language/introspection/methodinfo>`, `ObjectIterator</api/language/introspection/objectiterator>`, `ParameterInfo</api/language/introspection/parameterinfo>`, `PropertyInfo</api/language/introspection/propertyinfo>` classes; `GetTypeInfo</api/language/introspection/gettypeinfo>` function.

</div>
