Params: IForeNETMethodParams;
The Params property returns parameters collection of the custom .NET method.
The list of parameters is created basing on signature of procedure or function that are bases of custom .NET method. If signature can be changed, then to update list of parameters run the IBaseMethod.Bind method.
Executing the example requires that repository contains a custom .NET method with parameters.
Add links to system assemblies: Fore, ForeNet and Metabase.
Sub UserProc;
Var
Mb: IMetabase;
SharedParams: ISharedParamsEx;
Methods: IForeNETMethods;
Method: IForeNETMethod;
MethodParams: IForeNETMethodParams;
Param: IForeNETMethodParam;
i: Integer;
Begin
Mb := MetabaseClass.Active;
SharedParams := Mb.SpecialObject(MetabaseSpecialObject.SharedParams).Bind As ISharedParamsEx;
Methods := SharedParams.NETMethods;
Method := Methods.Item(0);
If Not IsNull(Method) Then
Method.Bind;
MethodParams := Method.Params;
Debug.WriteLine(MethodParams.Count.ToString);
For i := 0 To MethodParams.Count - 1 Do
Param := MethodParams.Item(i);
Debug.Write("Parameter: " + Param.Name);
Debug.WriteLine(". Type: " + Param.Type.ToString);
End For;
End If;
End Sub UserProc;
Imports Prognoz.Platform.Interop.Fore;
Imports Prognoz.Platform.Interop.KeFore;
Imports Prognoz.Platform.Interop.Metabase;
Public Shared Sub Main(Params: StartParams);
Var
Mb: IMetabase;
SharedParams: ISharedParamsEx;
Methods: IForeNETMethods;
Method: IForeNETMethod;
MethodParams: IForeNETMethodParams;
Param: IForeNETMethodParam;
i: Integer;
Begin
Mb := Params.Metabase;
SharedParams := Mb.SpecialObject[MetabaseSpecialObject.msoSharedParams].Bind() As ISharedParamsEx;
Methods := SharedParams.NETMethods;
Method := Methods.Item[0];
If Method <> Null Then
Method.Bind();
MethodParams := Method.Params;
For i := 0 To MethodParams.Count - 1 Do
Param := MethodParams.Item[i];
System.Diagnostics.Debug.Write("Parameter: " + Param.Name);
System.Diagnostics.Debug.WriteLine(". Type: " + Param.Type.ToString());
End For;
End If;
End Sub;
On executing the example the first custom .NET method will be initialized. The console dialog box will display names and types of all .NET method parameters.
See also: