ParameterInfo

From Xojo Documentation

Revision as of 18:56, 19 November 2009 by WikiSysop (talk) (1 revision)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)


Description

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


Super Class

Object

Properties

Name Type Description
IsByref Boolean True if the parameter is passed Byref.
ParameterType TypeInfo Contains the parameter's datatype.


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.


Examples

The following reports the data types of the parameters for all methods of a class instance that have parameters.

Dim tcp as New TCPSocket


Dim myMethods() As Introspection.MethodInfo =_
Introspection.GetType(tcp).GetMethods


For i as Integer = 0 to Ubound(myMethods)
Dim myParameters() as Introspection.ParameterInfo =_
   myMethods(i).GetParameters
If Ubound(myParameters) > 0 then //if a method has any parameters
For j as Integer=1 to Ubound(myParameters) //loop over the parameters
ListBox1.AddRow myMethods(i).Name
ListBox1.Cell(ListBox1.LastIndex,1)=_
   myParameters(j-1).ParameterType.Name
  Next
 End if
Next


See Also

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