[]
A collection of Variable objects that represent the variables added to a document or template. Document variables are used to preserve macro settings in between macro sessions.
public class VariableCollection : IReadOnlyList<Variable>, IReadOnlyCollection<Variable>, IEnumerable<Variable>, IEnumerable
Returns the number of variables in the document.
public int Count { get; }
Gets a document variable at the specified index.
public Variable this[int index] { get; }
index
intZero-based index of the document variable.
Gets a document variable by the case-insensitive name.
public Variable this[string name] { get; }
name
stringThe case-insensitive name of the variable.
Adds a varibale into the document.
public Variable Add(string name, string value)
Removes all elements from the collection.
public void Clear()
Gets whether a varibale with specified name exists in the document.
public bool Contains(string name)
name
stringA varibale name to check.
true if a varibale with specified name exists in the document, otherwise false.
Removes a document variable at the specified index.
public void Remove(int index)
index
intThe zero based index.
Removes a document variable with the specified name from the collection.
public void Remove(string name)
name
stringThe case-insensitive name of the variable.
Tries to get a variable by its name.
public bool TryGetValue(string name, out Variable variable)
true if a variable found, otherwise false.