# ConditionalInstructionCollection.CopyTo Method

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

- **Product:** TX Text Control .NET Server
- **Section:** Reference
- **Kind:** Method
- **Introduced:** 28.0
- **Namespace:** `TXTextControl`
- **Package:** `TXTextControl.TextControl.Core.SDK` (assembly `TXTextControl.Core.dll`, from the private NuGet feed or Text Control Offline Packages)
- **Package:** `TXTextControl.TextControl.ASP.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 Server > Reference > TXTextControl > ConditionalInstructionCollection.CopyTo Method
- **439 words**
- **Web URL:** https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/txtextcontrol/conditionalinstructioncollection/copyto-method/
- **LLMs URL:** https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/txtextcontrol/conditionalinstructioncollection/copyto-method/llms.txt
- **LLMs-Full URL:** https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/txtextcontrol/conditionalinstructioncollection/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(Array array, int index);
```

```vbnet
Public Sub CopyTo(array As Array, index As Integer)
```

### Parameters

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

### Examples

The following example copies the conditional instruction collection into a strongly typed array.

```csharp
ConditionalInstruction[] items = new ConditionalInstruction[conditionalInstructionCollection.Count];
conditionalInstructionCollection.CopyTo(items, 0);
```

```vbnet
If conditionalInstructionCollection.Count > 0 Then
    Dim items(conditionalInstructionCollection.Count - 1) As ConditionalInstruction
    conditionalInstructionCollection.CopyTo(items, 0)
End If
```

---

## Nearby

- **Previous:** [ConditionalInstructionCollection.ConditionalInstructionNames Property](https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/txtextcontrol/conditionalinstructioncollection/conditionalinstructionnames-property/llms-full.txt)
- **Next:** [ConditionalInstructionCollection.Count Property](https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/txtextcontrol/conditionalinstructioncollection/count-property/llms-full.txt)
