Clear;
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.
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: