# ParagraphCollection.GetEnumerator Method

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

- **Product:** TX Text Control .NET for Windows Forms
- **Section:** Reference
- **Kind:** Method
- **Introduced:** 15.0
- **Namespace:** `TXTextControl`
- **Package:** `TXTextControl.TextControl.WinForms.SDK` (assembly `TXTextControl.dll`, from the private NuGet feed or Text Control Offline Packages)
- **.NET Framework:** reference `TXTextControl.dll` from the setup
- **Path:** TX Text Control .NET for Windows Forms > Reference > TXTextControl > ParagraphCollection.GetEnumerator Method
- **525 words**
- **Web URL:** https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/paragraphcollection/getenumerator-method/
- **LLMs URL:** https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/paragraphcollection/getenumerator-method/llms.txt
- **LLMs-Full URL:** https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/paragraphcollection/getenumerator-method/llms-full.txt

---

### Description

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

### Syntax

```csharp
public ParagraphCollection.ParagraphEnumerator GetEnumerator();
```

```vbnet
Public Function GetEnumerator() As ParagraphCollection.ParagraphEnumerator
```

### 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`.

```csharp
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);
}
```

```vbnet
Dim paragraphCollection As ParagraphCollection = textControl.Paragraphs
textControl.Text = "Quarterly results" & vbCrLf & "Revenue increased by 12%."

Dim enumerator As IEnumerator = paragraphCollection.GetEnumerator()

While enumerator.MoveNext()
    Dim paragraph As Paragraph =
        DirectCast(enumerator.Current, Paragraph)
    Console.WriteLine(paragraph)
End While
```

---

## Nearby

- **Previous:** [ParagraphCollection.Count Property](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/paragraphcollection/count-property/llms-full.txt)
- **Next:** [ParagraphCollection.GetItem Method](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/paragraphcollection/getitem-method/llms-full.txt)
