[]
        
(Showing Draft Content)

GrapeCity.Documents.Word.VariableCollection

Class VariableCollection

Namespace
GrapeCity.Documents.Word
Assembly
GcDocs.Word.dll

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
Inheritance
object
VariableCollection
Implements
System.Collections.Generic.IReadOnlyList<T><Variable>
System.Collections.Generic.IReadOnlyCollection<T><Variable>
System.Collections.Generic.IEnumerable<T><Variable>
System.Collections.IEnumerable
Inherited Members
object.ToString()
object.Equals(object)
object.Equals(object, object)
object.ReferenceEquals(object, object)
object.GetHashCode()
object.GetType()
object.MemberwiseClone()

Properties

Count

Returns the number of variables in the document.

public int Count { get; }

Property Value

int

this[int]

Gets a document variable at the specified index.

public Variable this[int index] { get; }

Parameters

index int

Zero-based index of the document variable.

Property Value

Variable

A Variable with the specified index.

this[string]

Gets a document variable by the case-insensitive name.

public Variable this[string name] { get; }

Parameters

name string

The case-insensitive name of the variable.

Property Value

Variable

A Variable with the specified name.

Methods

Add(string, string)

Adds a varibale into the document.

public Variable Add(string name, string value)

Parameters

name string

The name of the document variable.

value string

The value for the document variable.

Returns

Variable

A Variable object that represents a variable added to a document.

Clear()

Removes all elements from the collection.

public void Clear()

Contains(string)

Gets whether a varibale with specified name exists in the document.

public bool Contains(string name)

Parameters

name string

A varibale name to check.

Returns

bool

true if a varibale with specified name exists in the document, otherwise false.

Remove(int)

Removes a document variable at the specified index.

public void Remove(int index)

Parameters

index int

The zero based index.

Remove(string)

Removes a document variable with the specified name from the collection.

public void Remove(string name)

Parameters

name string

The case-insensitive name of the variable.

TryGetValue(string, out Variable)

Tries to get a variable by its name.

public bool TryGetValue(string name, out Variable variable)

Parameters

name string

The variable name.

variable Variable

Found variable or null.

Returns

bool

true if a variable found, otherwise false.