Clear;
The Clear property clears the custom methods collection.
Executing the example requires that the repository contains an area of the global parameters with the SHARED_P identifier. The repository should also contain the MY_FUNC_ASSEMBLY unit that contains the PiDiv function.
Sub Main;
Var
mb: IMetabase;
Shp: ISharedParams;
UserMeth: IForeMethods;
uMethod: IForeMethod;
Begin
mb := MetabaseClass.Active;
Shp := mb.ItemById("SHARED_P").Edit As ISharedParams;
UserMeth := Shp.Methods;
UserMeth.Clear;
uMethod := UserMeth.Add;
uMethod.Assembly := "MY_FUNC_ASSEMBLY";
uMethod.Method := "PiDiv";
uMethod.Category := "My functions";
uMethod.Name := "'PiDiv function'";
uMethod.Description := "Value is divided by 'Pi'";
uMethod.ResultType := ForeResultType.Real;
uMethod.Type := ForeMethodType.Arithmetic;
Debug.WriteLine("Method key: " + uMethod.Key.ToString);
(Shp As IMetabaseObject).Save;
End Sub Main;
After executing this example the custom methods collection is cleared. Then a new PiDiv function is added into it.
See also: