ConstructorInfo.Invoke

From Xojo Documentation

Method

ConstructorInfo.Invoke([params() as Variant]) As Datatype of the object being instantiated.

Supported for all project types and targets.

Invokes the constructor. Pass the optional array of variants for the constructor's parameter values, if any. You will get an OutOfBoundsException if the number of parameters does not match or an IllegalCastException if the types do not match.

Sample Code

This code gets the ConstructorInfo for the FolderItem class. The Invoke method is used to create a new instance based on the constructor that takes no parameters.

Var ti As Introspection.TypeInfo = GetTypeInfo(FolderItem)
Var ci() As Introspection.ConstructorInfo = ti.GetConstructors

Var f As FolderItem
f = ci(0).Invoke