# DataColumnInfoCollection.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 > DataColumnInfoCollection.CopyTo Method
- **512 words**
- **Web URL:** https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol-documentserver-datasources/datacolumninfocollection/copyto-method/
- **LLMs URL:** https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol-documentserver-datasources/datacolumninfocollection/copyto-method/llms.txt
- **LLMs-Full URL:** https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol-documentserver-datasources/datacolumninfocollection/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(DataColumnInfo[] array, int arrayIndex);
```

```vbnet
Public Sub CopyTo(array As DataColumnInfo(), 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 column info collection into a strongly typed array.

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

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

---

## Nearby

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