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.

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 + "(" + String.FromArray(paramTypes, ", ") + ") As " + method.ReturnType.Name)
  Else
    Listbox1.AddRow("Sub " + method.Name + "(" + String.FromArray(paramTypes, ", ") + ")")
  End If
Next

Compatibility

All project types on all supported operating systems.