IForeNETMethods.Add

Syntax

Add: IForeNETMethod;

Add(): Prognoz.Platform.Interop.ForeNet.IForeNETMethod;

Description

The Add method adds a new .NET method to the collection and returns its parameters.

Example

Executing the example requires that repository contains a .NET assembly with the GLOBAL_NET_METHODS identifier. The PiDivNet function is implemented in the global namespace of .NET assembly.

Add links to the Fore and Metabase system assemblies.

Sub UserProc;
Var
    Mb: IMetabase;
    SharedParams: ISharedParamsEx;
    Methods: IForeNETMethods;
    Method: IForeNETMethod;
Begin
    Mb := MetabaseClass.Active;
    SharedParams:= Mb.SpecialObject(MetabaseSpecialObject.SharedParams).Edit 
As ISharedParamsEx;
    Methods := SharedParams.NETMethods;
    Method := Methods.Add;
    Method.Assembly := 
"GLOBAL_NET_METHODS";
    Method.Namespace_ := 
"GLOBAL_NET_METHODS";
    Method.Method := 
"PiDivNet";
    Method.Category := 
"My functions";
    Method.Name := 
"'PiDivNet' function";
    Method.Description := 
"Divide value into 'Pi'";
    Method.ResultType := ForeResultType.Real;
    Debug.WriteLine(
"Method key: " + Method.Key.ToString);
    (SharedParams 
As IMetabaseObject).Save;
End Sub UserProc;

Public Shared Sub Main(Params: StartParams);
Var
    Mb: IMetabase;
    SharedParams: ISharedParamsEx;
    Methods: IForeNETMethods;
    Method: IForeNETMethod;
Begin
    Mb := Params.Metabase;
    SharedParams:= Mb.SpecialObject[MetabaseSpecialObject.msoSharedParams].Edit() 
As ISharedParamsEx;
    Methods := SharedParams.NETMethods;
    Method := Methods.Add();
    Method.Assembly := 
"GLOBAL_NET_METHODS";
    Method.@Namespace := 
"GLOBAL_NET_METHODS";
    Method.Method := 
"PiDivNet";
    Method.Category := 
"My functions";
    Method.Name := 
"'PiDivNet' function";
    Method.Description := 
"Divide value into 'Pi'";
    Method.ResultType := ForeResultType.frtReal;
    System.Diagnostics.Debug.WriteLine(
"Method key: " + Method.Key.ToString());
    (SharedParams 
As IMetabaseObject).Save();
End Sub;

On executing the example a new PiDivNet .NET function is added into the collection of the custom methods.

See also:

IForeNETMethods