Class

# ConstructorInfo

<div class="rst-class">

forsearch

</div>

Introspection

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

## Description

Contains information about the constructors for a class via the `Introspection</api/language/introspection/introspection>` system.

## Properties

<div class="rst-class">

table-centered_columns_3_and_4

</div>

| Name                                       | Type                               | Read-Only | Shared |
|--------------------------------------------|------------------------------------|-----------|--------|
| `IsPrivate<constructorinfo.isprivate>`     | `Boolean</api/data_types/boolean>` | ✓         |        |
| `IsProtected<constructorinfo.isprotected>` | `Boolean</api/data_types/boolean>` | ✓         |        |
| `IsPublic<constructorinfo.ispublic>`       | `Boolean</api/data_types/boolean>` | ✓         |        |
| `Name<constructorinfo.name>`               | `String</api/data_types/string>`   | ✓         |        |

## Methods

<div class="rst-class">

table-centered_column_4

</div>

| Name                                           | Parameters                                                                        | Returns                                                      | Shared |
|------------------------------------------------|-----------------------------------------------------------------------------------|--------------------------------------------------------------|--------|
| `GetAttributes<constructorinfo.getattributes>` |                                                                                   | `AttributeInfo()</api/language/introspection/attributeinfo>` |        |
| `GetParameters<constructorinfo.getparameters>` |                                                                                   | `ParameterInfo()</api/language/introspection/parameterinfo>` |        |
| `Invoke<constructorinfo.invoke>`               | `Optional</api/language/optional>` params() As `Variant</api/data_types/variant>` | `Variant</api/data_types/variant>`                           |        |

## Property descriptions

<div id="constructorinfo.isprivate">

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

</div>

<div class="rst-class">

forsearch

</div>

ConstructorInfo.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="constructorinfo.isprotected">

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

</div>

<div class="rst-class">

forsearch

</div>

ConstructorInfo.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="constructorinfo.ispublic">

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

</div>

<div class="rst-class">

forsearch

</div>

ConstructorInfo.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="constructorinfo.name">

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

</div>

<div class="rst-class">

forsearch

</div>

ConstructorInfo.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="constructorinfo.getattributes">

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

</div>

<div class="rst-class">

forsearch

</div>

ConstructorInfo.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="constructorinfo.getparameters">

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

</div>

<div class="rst-class">

forsearch

</div>

ConstructorInfo.GetParameters

**GetParameters** As `ParameterInfo()</api/language/introspection/parameterinfo>`

> Returns an array of `ParameterInfo</api/language/introspection/parameterinfo>` items. Use GetParameters to obtain datatype information on the constructor's parameters.

<div id="constructorinfo.invoke">

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

</div>

<div class="rst-class">

forsearch

</div>

ConstructorInfo.Invoke

**Invoke**(`Optional</api/language/optional>` params() As `Variant</api/data_types/variant>`) As `Variant</api/data_types/variant>`

> Invokes the constructor. Pass the optional array of variants for the constructor's parameter values, if any. You will get an `OutOfBoundsException</api/exceptions/outofboundsexception>` if the number of parameters does not match or an `IllegalCastException</api/exceptions/illegalcastexception>` if the types do not match.

## Sample code

This code uses the Invoke method to call the FolderItem constructor that takes no parameters:

``` 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>`, `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>`, `TypeInfo</api/language/introspection/typeinfo>` classes; `GetTypeInfo</api/language/introspection/gettypeinfo>` function.

</div>
