# HeaderFooterCollection.GetEnumerator Method

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

- **Product:** TX Text Control .NET for WPF
- **Section:** Reference
- **Kind:** Method
- **Namespace:** `TXTextControl`
- **Package:** `TXTextControl.TextControl.WPF.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 WPF > Reference > TXTextControl > HeaderFooterCollection.GetEnumerator Method
- **544 words**
- **Web URL:** https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/headerfootercollection/getenumerator-method/
- **LLMs URL:** https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/headerfootercollection/getenumerator-method/llms.txt
- **LLMs-Full URL:** https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/headerfootercollection/getenumerator-method/llms-full.txt

---

### Description

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

### Syntax

```csharp
public HeaderFooterCollection.HeaderFooterEnumerator GetEnumerator();
```

```vbnet
Public Function GetEnumerator() As HeaderFooterCollection.HeaderFooterEnumerator
```

### Return Value

The return value is an IEnumerator that represents the collection.

### Examples

The following example explicitly enumerates all header/footer variants and makes their text bold.

```csharp
HeaderFooterCollection headersAndFooters = textControl.Sections[1].HeadersAndFooters;
headersAndFooters.Add(HeaderFooterType.Header);
IEnumerator enumerator = headersAndFooters.GetEnumerator();
while (enumerator.MoveNext())
{
    HeaderFooter part = (HeaderFooter)enumerator.Current;
    part.Selection.Bold = true;
}
```

```vbnet
Dim headersAndFooters As HeaderFooterCollection = textControl.Sections(1).HeadersAndFooters
headersAndFooters.Add(HeaderFooterType.Header)
Dim enumerator As IEnumerator = headersAndFooters.GetEnumerator()
While enumerator.MoveNext()
    Dim part As HeaderFooter = DirectCast(enumerator.Current, HeaderFooter)
    part.Selection.Bold = True
End While
```

---

## Nearby

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