# DataRelationInfoCollection.GetEnumerator Method

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

- **Product:** TX Text Control .NET Server
- **Section:** Reference
- **Kind:** Method
- **Introduced:** 24.0
- **Namespace:** `TXTextControl.DocumentServer.DataSources`
- **Package:** `TXTextControl.TextControl.Core.SDK` (assembly `TXDocumentServer.Core.dll`, from the private NuGet feed or Text Control Offline Packages)
- **Package:** `TXTextControl.TextControl.ASP.SDK` (assembly `TXDocumentServer.dll`, from the private NuGet feed or Text Control Offline Packages)
- **.NET Framework:** reference `TXDocumentServer.dll` from the setup
- **Path:** TX Text Control .NET Server > Reference > TXTextControl.DocumentServer.DataSources > DataRelationInfoCollection.GetEnumerator Method
- **493 words**
- **Web URL:** https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/txtextcontrol-documentserver-datasources/datarelationinfocollection/getenumerator-method/
- **LLMs URL:** https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/txtextcontrol-documentserver-datasources/datarelationinfocollection/getenumerator-method/llms.txt
- **LLMs-Full URL:** https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/txtextcontrol-documentserver-datasources/datarelationinfocollection/getenumerator-method/llms-full.txt

---

### Description

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

### Syntax

```csharp
public IEnumerator<DataRelationInfo> GetEnumerator();
```

```vbnet
Public Function GetEnumerator() As IEnumerator(Of DataRelationInfo)
```

### Return Value

The return value is an IEnumerator that represents the collection.

### Examples

The following example obtains an enumerator and visits each data relation info in the collection.

```csharp
IEnumerator enumerator = dataRelationInfoCollection.GetEnumerator();

while (enumerator.MoveNext())
{
    TXTextControl.DocumentServer.DataSources.DataRelationInfo dataRelationInfo = (TXTextControl.DocumentServer.DataSources.DataRelationInfo)enumerator.Current;
    Console.WriteLine(dataRelationInfo);
}
```

```vbnet
Dim enumerator As IEnumerator = dataRelationInfoCollection.GetEnumerator()

While enumerator.MoveNext()
    Dim dataRelationInfo As TXTextControl.DocumentServer.DataSources.DataRelationInfo =
        DirectCast(enumerator.Current, TXTextControl.DocumentServer.DataSources.DataRelationInfo)
    Console.WriteLine(dataRelationInfo)
End While
```

---

## Nearby

- **Previous:** [DataRelationInfoCollection.Count Property](https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/txtextcontrol-documentserver-datasources/datarelationinfocollection/count-property/llms-full.txt)
- **Next:** [DataRelationInfoCollection.IsReadOnly Property](https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/txtextcontrol-documentserver-datasources/datarelationinfocollection/isreadonly-property/llms-full.txt)
