Difference between revisions of "ConstructorInfo"

From Xojo Documentation

(Examples)
 
(One intermediate revision by the same user not shown)
Line 13: Line 13:
  
 
<dynamicTable id="Methods" super="MemberInfo" class="methodTable" title="Methods" columns="3">
 
<dynamicTable id="Methods" super="MemberInfo" class="methodTable" title="Methods" columns="3">
{{Method | name=GetParameters | returntype=[[ParameterInfoList|ParameterInfo()]] | description=GetParameters() as ParameterInfo()&#x0A;Returns an array of ParameterInfo items }}
+
{{Method | name=GetParameters | description=GetParameters() as ParameterInfo()&#x0A;Returns an array of ParameterInfo items }}
 
{{Method | name=Invoke | params=[params() as [[Variant]]]  | returntype=Datatype of the object being instantiated. | modifiedinversion=2008r2 | description=Invoke([params() as Variant] ) as Datatype of the object being instantiated.&#x0A;Invokes the constructor }}
 
{{Method | name=Invoke | params=[params() as [[Variant]]]  | returntype=Datatype of the object being instantiated. | modifiedinversion=2008r2 | description=Invoke([params() as Variant] ) as Datatype of the object being instantiated.&#x0A;Invokes the constructor }}
 
</dynamicTable>
 
</dynamicTable>
Line 20: Line 20:
 
This code uses the Invoke method to call the FolderItem constructor that takes no parameters:
 
This code uses the Invoke method to call the FolderItem constructor that takes no parameters:
 
<rbcode>
 
<rbcode>
Dim ti As Introspection.TypeInfo = GetTypeInfo(FolderItem)
+
Var ti As Introspection.TypeInfo = GetTypeInfo(FolderItem)
Dim ci() As Introspection.ConstructorInfo = ti.GetConstructors
+
Var ci() As Introspection.ConstructorInfo = ti.GetConstructors
  
Dim f As FolderItem
+
Var f As FolderItem
 
f = ci(0).Invoke
 
f = ci(0).Invoke
 
</rbcode>
 
</rbcode>

Latest revision as of 21:03, 28 January 2021

Class (inherits from MemberInfo)

Contains information about the constructors for a class via the Introspection system.

Properties
IsPrivate fa-lock-32.png IsPublic fa-lock-32.png
IsProtected fa-lock-32.png Name fa-lock-32.png


Methods
GetAttributes GetParameters Invoke

Sample Code

This code uses the Invoke method to call the FolderItem 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

See Also

Introspection module; AttributeInfo, MemberInfo, MethodInfo, ObjectIterator, ParameterInfo, PropertyInfo, TypeInfo classes; GetTypeInfo function.

Xojo.Introspection.ConstructorInfo