TX Text Control .NET for Windows Forms

GetEnumerator Method

Method|Introduced in 15.0
Namespace
TXTextControl
Package
TXTextControl.TextControl.WinForms.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 ParagraphCollection.ParagraphEnumerator GetEnumerator();

Return Value

The return value is an IEnumerator that represents the collection.

Examples

The following example works with paragraphs in the current document by using ParagraphCollection.GetEnumerator.

ParagraphCollection paragraphCollection = textControl.Paragraphs;
textControl.Text = "Quarterly results\nRevenue increased by 12%.";

IEnumerator enumerator = paragraphCollection.GetEnumerator();

while (enumerator.MoveNext())
{
    Paragraph paragraph = (Paragraph)enumerator.Current;
    Console.WriteLine(paragraph);
}