INonLDVariables.Clear

Fore Syntax

Clear;

Fore.NET Syntax

Clear();

Description

The Clear method removes all variables from the collection.

Comments

To remove variable from the collection by its index, use the INonLDVariables.Remove method.

Fore Example

Add a link to the Cp system assembly.

Sub UserProc;
Var
    Optima: NonLinearDecomposition;
    Vars: INonLDVariables;
    Vrbl: INonLDVariable;
Begin
    Optima := New NonLinearDecomposition.Create;
    Vars := Optima.Variables;
    Vrbl := Vars.Add("x1");
    Vrbl := Vars.Add("x2");
    Vars.Clear;
    Debug.Writeline("Variables in collection: " + Vars.Count);
End Sub UserProc;

After executing the example all variables are removed from the collection. The console window displays collection size.

Fore.NET Example

The requirements and result of the Fore.NET example execution match with those in the Fore example.

Imports Prognoz.Platform.Interop.Cp;

Public Shared Sub Main(Params: StartParams);
Var
    Optima: NonLinearDecomposition;
    Vars: INonLDVariables;
    Vrbl: INonLDVariable;
Begin
    Optima := New NonLinearDecomposition.Create();
    Vars := Optima.Variables;
    Vrbl := Vars.Add("x1");
    Vrbl := Vars.Add("x2");
    Vars.Clear();
    System.Diagnostics.Debug.Writeline("Variables in collection: " + Vars.Count);
End Sub;

See also:

INonLDVariables