Assembly(Assembly: IForeNETAssembly): IForeNETRuntimeAssembly;
Assembly. .NET assembly of repository, context of which is necessary to get.
The Assembly property returns the context of repository .NET assembly.
When the context of .NET assembly is received, it becomes possible to use its resources. All types, defined in assembly, and forms, that are created within this assembly, are accessed through the assembly context.
Executing this example requires that the repository contains a .NET assembly with the TestAssm identifier. The TestClass class is implemented in this assembly. There is the TestFunc function in this class that has no parameters and returns some value.
Sub UserProc;
Var
MB: IMetabase;
Run: IForeNETRuntime;
Asm: IForeNETRuntimeAssembly;
Typ: IForeNETRuntimeType;
TypInst: IForeNETRuntimeObjectInstance;
v: Variant;
Begin
MB := MetabaseClass.Active;
Run := ForeNETAssemblyClass.Runtime;
Asm := Run.Assembly(MB.ItemById("TestAssm").Bind As IForeNETAssembly);
Typ := Asm.Type("TestAssm.TestClass");
TypInst := Typ.CreateInstance;
v := TypInst.InvokeMethod("TestFunc", New Variant[0]);
End Sub UserProc;
On executing the example the context of the TestAssm assembly is received. The TestClass type is received and the object instance of this type is created from this assembly. The TestFunc function is called for this object. The result of function work is contained in the "v" variable.
See also: