Clear;
The Clear method removes all variables from the collection.
To remove variable from the collection by its index, use the INonLDVariables.Remove method.
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.
See also: