# DataRelationInfoCollection.CopyTo Method

> Copies the elements of the collection to an array, starting at a particular index.

- **Product:** TX Text Control .NET for Windows Forms
- **Section:** Reference
- **Kind:** Method
- **Introduced:** 24.0
- **Namespace:** `TXTextControl.DocumentServer.DataSources`
- **Package:** `TXTextControl.TextControl.WinForms.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 for Windows Forms > Reference > TXTextControl.DocumentServer.DataSources > DataRelationInfoCollection.CopyTo Method
- **516 words**
- **Web URL:** https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol-documentserver-datasources/datarelationinfocollection/copyto-method/
- **LLMs URL:** https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol-documentserver-datasources/datarelationinfocollection/copyto-method/llms.txt
- **LLMs-Full URL:** https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol-documentserver-datasources/datarelationinfocollection/copyto-method/llms-full.txt

---

### Description

Copies the elements of the collection to an array, starting at a particular index.

### Syntax

```csharp
public void CopyTo(DataRelationInfo[] array, int arrayIndex);
```

```vbnet
Public Sub CopyTo(array As DataRelationInfo(), arrayIndex As Integer)
```

### Parameters

| Parameter | Description |
|---|---|
| array | Specifies the array to copy to. |
| arrayIndex | Specifies the index of the destination array at which to begin copying. |

### Examples

The following example copies the data relation info collection into a strongly typed array.

```csharp
TXTextControl.DocumentServer.DataSources.DataRelationInfo[] items = new TXTextControl.DocumentServer.DataSources.DataRelationInfo[dataRelationInfoCollection.Count];
dataRelationInfoCollection.CopyTo(items, 0);
```

```vbnet
If dataRelationInfoCollection.Count > 0 Then
    Dim items(dataRelationInfoCollection.Count - 1) As TXTextControl.DocumentServer.DataSources.DataRelationInfo
    dataRelationInfoCollection.CopyTo(items, 0)
End If
```

---

## Nearby

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