Implements: IVariableCollection
Description
The VariableCollection allows you to implement a list of variables.
Properties
Length
Gets the number of variables stored in the collection.
public virtualint Length { get; }
Instance methods
Add
Adds a new variable to the collection.
public virtualvoid Add(IVariable variable)
- variable: IVariable - variable to be added.
Clear
Clears the collection.
public virtualvoid Clear()
ClearValues
Clears all stored variables (assigns null values).
public virtualvoid ClearValues()
FindByName
Finds a variable in the list by it’s name.
public virtualIVariable FindByName(string name)
- name: string - variable name to be found.
- returns: IVariable - Variable or null if the variable was not found.
FindIndexByName
Finds a variable index in the list by the variable’s name.
public virtualint FindIndexByName(string name)
- name: string - name of the variable to be found.
- returns: int - variable index in the list or -1 if the variable was not found.
Get
Gets a variable by its index.
public virtualIVariable Get(int index)
- index: string - variable index.
- returns: IVariable - retrieved variable.
GetAll
Gets all the variables stored in the collection.
public virtualIList<IVariable> GetAll()
- returns: IVariable - list with stored variables.
Locate
Finds a variable in the list or creates a new one if the variable was not found.
public virtualIVariable Locate(string name)
- name: string - name of the variable to be found.
- returns: IVariable - found or created variable.
Remove
Removes a variable by its index.
public virtualvoid Remove(int index)
- index: int - index of the variable to be removed.
RemoveByName
Removes a variable by it’s name.
public virtualvoid RemoveByName(string name)
- name: string - name of the variable to be removed.