# Copy

> Copies a range of bits from this array to another range in this array.

## Definition

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

## Copy(int, int, int)

Copies a range of bits from this array to another range in this array.

```csharp
public void Copy(int dstPos, int srcPos, int numBits)
```

### Parameters

**** (\[int]\(https\://learn.microsoft.com/dotnet/api/system.int32)): Index of the first bit to set.**** (\[int]\(https\://learn.microsoft.com/dotnet/api/system.int32)): Index of the first bit to copy.**** (\[int]\(https\://learn.microsoft.com/dotnet/api/system.int32)): Number of bits to copy.

### Remarks

The bits to copy run from index `srcPos` up to (but not including) `srcPos + numBits`. The bits to set run from index `dstPos` up to (but not including) `dstPos + numBits`.

The ranges may overlap, but the result in the overlapping region is undefined.

## Copy(int, NativeBitArray, int, int)

Copies a range of bits from an array to a range of bits in this array.

```csharp
public void Copy(int dstPos, ref NativeBitArray srcBitArray, int srcPos, int numBits)
```

### Parameters

**** (\[int]\(https\://learn.microsoft.com/dotnet/api/system.int32)): Index of the first bit to set.**** (\[NativeBitArray]\(/engine/6000.7/script-reference/unity/collections/nativebitarray)): The source array.**** (\[int]\(https\://learn.microsoft.com/dotnet/api/system.int32)): Index of the first bit to copy.**** (\[int]\(https\://learn.microsoft.com/dotnet/api/system.int32)): The number of bits to copy.

### Remarks

The bits to copy in the source array run from index srcPos up to (but not including) `srcPos + numBits`. The bits to set in the destination array run from index dstPos up to (but not including) `dstPos + numBits`.

When the source and destination are the same array, the ranges may still overlap, but the result in the overlapping region is undefined.
