GetEnumerator Method
- Namespace
TXTextControl
- Package
TXTextControl.asTextControl. WPF. SDK TXTextControl.from the private NuGet feed or Text Control Offline Packagesdll
Description
Returns an enumerator that can be used to iterate through the collection.
Syntax
public TableOfContentsCollection.TableOfContentEnumerator GetEnumerator();Public Function GetEnumerator() As TableOfContentsCollection.TableOfContentEnumeratorReturn 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);
}textControl.Text = "Customer: Contoso Ltd."
textControl.Select(10, 12)
Dim tableOfContentsCollection As TableOfContentsCollection = textControl.TablesOfContents
tableOfContentsCollection.Add(New TableOfContents(1, 3) With { .Name = "Contents", .ID = 100 })
Dim enumerator As IEnumerator = tableOfContentsCollection.GetEnumerator()
While enumerator.MoveNext()
Dim tableOfContents As TableOfContents =
DirectCast(enumerator.Current, TableOfContents)
Console.WriteLine(tableOfContents)
End While