ClassItem(ClassIndex: Integer): IForeClass;
ClassItem(ClassIndex: Integer): Prognoz.Platform.Interop.Fore.IForeClass;
ClassIndex. Index of construction implemented in assembly. The index value is specified in the [0, ClassesCount-1] range.
The ClassItem method returns information about assembly construction with the specified index.
Executing the example requires that repository contains an assembly with the ASSM_TEST identifier.
Add a link to the Fore, Metabase system assembly.
Sub UserProc;
Var
ForeService: IForeServices;
Runtime: IForeRuntime;
Assm: IForeAssembly;
FClass: IForeClass;
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 interfaces, classes, enumerations
j := Assm.ClassesCount - 1;
For i := 0 To j Do
FClass := Assm.ClassItem(i);
Select Case FClass.ClassType
Case ForeClassType.Class_: Debug.Write("Class: ");
Case ForeClassType.Interface_: Debug.Write("Interface: ");
Case ForeClassType.Enum_: Debug.Write("Enumeration: ");
End Select;
Debug.Write(FClass.Name);
Debug.Write("; Access modifier: ");
Select Case FClass.ClassAccessSpecificatorKind
Case AccessSpecificatorKind.Public_: Debug.WriteLine("Public");
Case AccessSpecificatorKind.Private_: Debug.WriteLine("Private");
Case AccessSpecificatorKind.Protected_: Debug.WriteLine("Protected");
Case AccessSpecificatorKind.Friend_: Debug.WriteLine("Friend");
Case AccessSpecificatorKind.ProtectedFriend: Debug.WriteLine("ProtectedFriend");
End Select;
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;
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 interfaces, classes, enumerations
j := Assm.ClassesCount() - 1;
For i := 0 To j Do
FClass := Assm.ClassItem(i);
Select Case FClass.ClassType
Case ForeClassType.fctClass: System.Diagnostics.Debug.Write("Class: ");
Case ForeClassType.fctInterface: System.Diagnostics.Debug.Write("Interface: ");
Case ForeClassType.fctEnum: System.Diagnostics.Debug.Write("Enumeration: ");
End Select;
System.Diagnostics.Debug.Write(FClass.Name);
System.Diagnostics.Debug.Write("; Access modifier: ");
Select Case FClass.ClassAccessSpecificatorKind
Case AccessSpecificatorKind.ackPublic: System.Diagnostics.Debug.WriteLine("Public");
Case AccessSpecificatorKind.ackPrivate: System.Diagnostics.Debug.WriteLine("Private");
Case AccessSpecificatorKind.ackProtected: System.Diagnostics.Debug.WriteLine("Protected");
Case AccessSpecificatorKind.ackFriend: System.Diagnostics.Debug.WriteLine("Friend");
Case AccessSpecificatorKind.ackProtectedFriend: System.Diagnostics.Debug.WriteLine("ProtectedFriend");
End Select;
End For;
End Sub;
On executing the example, the repository assembly with the specified identifier will be loaded to the execution environment. The information about constructions that are implemented in assembly will be displayed to development environment console.
See also: