ParameterInfo

From Xojo Documentation

Class (inherits from Object)

Used to get information about the parameters of a method via the Introspection system.

Properties
IsByref fa-lock-32.png ParameterType fa-lock-32.png

Notes

You obtain an array of ParameterInfo by calling the MethodInfo.GetParameters method. Get the number of parameters for a method by getting the Ubound of the resulting array and cycle through the parameters by examining the ith element. Examine the ParameterType of each element to get its datatype.

Sample Code

This code displays signatures for all methods of a class:

Var cls As Introspection.TypeInfo = GetTypeInfo(Dictionary)
For Each method As Introspection.MethodInfo In cls.GetMethods
// Collect parameter types
Var paramTypes() As String
For Each paramInfo As Introspection.ParameterInfo In method.GetParameters
paramTypes.Add(paramInfo.ParameterType.Name)
Next

// Build the method signature
If method.ReturnType <> Nil Then
Listbox1.AddRow("Function " + method.Name + "(" + Join(paramTypes, ", ") + ") As " + method.ReturnType.Name)
Else
Listbox1.AddRow("Sub " + method.Name + "(" + Join(paramTypes, ", ") + ")")
End If
Next

See Also

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