Class

ParameterInfo


Description

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

Properties

Name

Type

Read-Only

Shared

IsByref

Boolean

ParameterType

TypeInfo

Property descriptions


ParameterInfo.IsByref

IsByref As Boolean

True if the parameter is passed Byref.

This property is read-only.


ParameterInfo.ParameterType

ParameterType As TypeInfo

Contains the parameter's datatype.

This property is read-only.

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

Notes

You obtain an array of ParameterInfo by calling the MethodInfo.GetParameters method. Get the number of parameters for a method by getting the Arrays.LastIndex 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

Compatibility

All project types on all supported operating systems.