# CopyTo

> Copies all elements to a NativeArray<T>.ReadOnly or managed array of the same length.

## Definition

* **Type:** Method
* **Namespace:** [Unity.Collections](/engine/6000.7/script-reference/unity/collections.md)
* **Assembly:** UnityEngine.ManagedKernelModule

## CopyTo(\`0\[])

Copies all elements to a [NativeArray\<T>.ReadOnly](/engine/6000.7/script-reference/unity/collections/nativearray1/readonly.md) or managed array of the same length.

```csharp
public void CopyTo(T[] array)
```

### Parameters

**** (\[\<T>\[]]\(./)): The destination array to copy to.

## CopyTo(NativeArray\<T>)

Copies all elements to a [NativeArray\<T>.ReadOnly](/engine/6000.7/script-reference/unity/collections/nativearray1/readonly.md) or managed array of the same length.

```csharp
public void CopyTo(NativeArray<T> array)
```

### Parameters

**** (\[NativeArray\<T>]\(/engine/6000.7/script-reference/unity/collections/nativearray1)): The destination array to copy to.
