TX Text Control .NET for WPF

GetEnumerator Method

Method|Introduced in 29.0
Namespace
TXTextControl
Package
TXTextControl.TextControl.WPF.SDK as TXTextControl.dll from the private NuGet feed or Text Control Offline Packages

Description

Returns an enumerator that can be used to iterate through the collection.

Syntax

public TableOfContentsCollection.TableOfContentEnumerator GetEnumerator();

Return Value

The return value is an IEnumerator that represents the collection.

Examples

The following example works with tables of contents in the current document by using TableOfContentsCollection.GetEnumerator.

textControl.Text = "Customer: Contoso Ltd.";
textControl.Select(10, 12);
TableOfContentsCollection tableOfContentsCollection = textControl.TablesOfContents;
tableOfContentsCollection.Add(new TableOfContents(1, 3) { Name = "Contents", ID = 100 });

IEnumerator enumerator = tableOfContentsCollection.GetEnumerator();

while (enumerator.MoveNext())
{
    TableOfContents tableOfContents = (TableOfContents)enumerator.Current;
    Console.WriteLine(tableOfContents);
}