BindToClass(ClassName: String): IForeClass;
BindToClass(ClassName: String): Prognoz.Platform.Interop.Fore.IForeClass;
ClassName. Class/interface/enumeration name.
The BindToClass method returns information about class/interface/enumeration with the specified name.
The method returns Null, if class/interface/enumeration with the specified name are not found in assembly.
Executing the example requires that the repository contains an assembly with the ASSM_TEST identifier. The CCalculate class is implemented in assembly.
Add a link to the Fore, Metabase system assembly.
Sub UserProc;
Var
ForeService: IForeServices;
Runtime: IForeRuntime;
Assm: IForeAssembly;
FClass: IForeClass;
FSub: IForeSub;
i, j: Integer;
Begin
ForeService := MetabaseClass.Active As IForeServices;
Runtime := ForeService.GetRuntime;
//Load assembly
Runtime.LoadAssembly("ASSM_TEST");
Assm := Runtime.BindToAssembly("ASSM_TEST");
//Get information about class procedures/functions
FClass := Assm.BindToClass("CCalculate");
j := FClass.SubsCount - 1;
For i := 0 To j Do
FSub := FClass.SubItem(i);
If FSub.IsConstructor Then
Debug.Write("Constructor: ");
Elseif FSub.IsStatic Then
If FSub.IsResult Then
Debug.Write("Static function: ");
Else
Debug.Write("Static procedure: ");
End If;
Else
If FSub.IsResult Then
Debug.Write("Function: ");
Else
Debug.Write("Procedure: ");
End If;
End If;
Debug.WriteLine(FSub.Name);
End For;
End Sub UserProc;
Imports Prognoz.Platform.Interop.Fore;
Imports Prognoz.Platform.Interop.Metabase;
Public Shared Sub Main(Params: StartParams);
Var
ForeService: IForeServices;
Runtime: IForeRuntime;
Assm: IForeAssembly;
FClass: IForeClass;
FSub: IForeSub;
i, j: Integer;
Begin
ForeService := Params.Metabase As IForeServices;
Runtime := ForeService.GetRuntime();
//Load assembly
Runtime.LoadAssembly("ASSM_TEST");
Assm := Runtime.BindToAssembly("ASSM_TEST");
//Get information about class procedures/functions
FClass := Assm.BindToClass("CCalculate");
j := FClass.SubsCount() - 1;
For i := 0 To j Do
FSub := FClass.SubItem(i);
If FSub.IsConstructor Then
System.Diagnostics.Debug.Write("Constructor: ");
Elseif FSub.IsStatic Then
If FSub.IsResult Then
System.Diagnostics.Debug.Write("Static function: ");
Else
System.Diagnostics.Debug.Write("Static procedure: ");
End If;
Else
If FSub.IsResult Then
System.Diagnostics.Debug.Write("Function: ");
Else
System.Diagnostics.Debug.Write("Procedure: ");
End If;
End If;
System.Diagnostics.Debug.WriteLine(FSub.Name);
End For;
End Sub;
On executing the example, the repository assembly with the specified identifier will be loaded to the execution environment. The list of procedures/functions implemented in the CCalculate class will be displayed to the development environment console.
See also: