# CopyTo

> Copies all the elements of a NativeSlice<T> to a NativeArray<T> 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(NativeArray\<T>)

Copies all the elements of a [NativeSlice\<T>](/engine/6000.7/script-reference/unity/collections/nativeslice1.md) to a [NativeArray\<T>](/engine/6000.7/script-reference/unity/collections/nativearray1.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 array to copy elements to.

## CopyTo(\`0\[])

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

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

### Parameters

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