Item(Index: Integer): IForeSubParam;
Index. Parameter index in the collection.
The Item method returns a parameter by index.
Executing the example requires a unit with the MODULE identifier. In the unit global namespace the function is implemented:
Function Calculate(a, b: Integer; c: Double): Double;
Var
Result: Double;
Begin
//...
//Calculate taking into account parameter values
//...
Return Result
End Function Calculate;
Add a link to the Fore, Metabase system assembly.
Sub UserProc;
Var
ForeService: IForeServices;
Runtime: IForeRuntime;
Assm: IForeAssembly;
FSub: IForeSub;
Params: IForeSubParams;
Param: IForeSubParam;
i, c: Integer;
Begin
ForeService := MetabaseClass.Active As IForeServices;
Runtime := ForeService.GetRuntime;
//Load assembly
Assm := Runtime.BindToAssembly("MODULE");
//Get function
FSub := Assm.BindToSub("Calculate");
//Get information about function parameters
Params := FSub.Params;
c := Params.Count;
For i := 0 To c - 1 Do
Param := Params.Item(i);
Debug.WriteLine("Parameter: " + Param.Name + "; Value type: " + Param.TypeName + "; Send parameter by link: " + Param.IsVar.ToString);
End For;
End Sub UserProc;
On executing the example, the specified unit is loaded to execution environment. The Calculate function will be obtained and the information about its parameters will be displayed to the development environment console.
See also: