# Append

> Appends UTF-8 text to a buffer.

## Definition

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

## Append(byte\*, ushort, ushort, byte\*, ushort)

Appends UTF-8 text to a buffer.

```csharp
public static CopyError Append(byte* dest, ref ushort destLength, ushort destUTF8MaxLengthInBytes, byte* src, ushort srcLength)
```

### Parameters

**** (\[byte\*]\(https\://learn.microsoft.com/dotnet/api/system.byte)): The destination buffer.**** (\[ushort]\(https\://learn.microsoft.com/dotnet/api/system.uint16)): Reference to the destination buffer's length in bytes "before" the append. Will be assigned the number of bytes appended.**** (\[ushort]\(https\://learn.microsoft.com/dotnet/api/system.uint16)): The destination buffer's length in bytes. Data will not be appended past this length.**** (\[byte\*]\(https\://learn.microsoft.com/dotnet/api/system.byte)): The source buffer.**** (\[ushort]\(https\://learn.microsoft.com/dotnet/api/system.uint16)): The number of bytes to read from the source.

### Returns

| Type                                                                        | Description                                                                                                                                                                                                                                |
| --------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| [CopyError](/engine/6000.7/script-reference/unity/collections/copyerror.md) | [CopyError.None](/engine/6000.7/script-reference/unity/collections/copyerror/none.md) if the append fully completes. Otherwise, returns [CopyError.Truncation](/engine/6000.7/script-reference/unity/collections/copyerror/truncation.md). |

### Remarks

Assumes the source data is valid UTF-8.

## Append(byte\*, ushort, ushort, char\*, int)

Appends UCS-2 text to a buffer, encoded as UTF-8.

```csharp
public static CopyError Append(byte* dest, ref ushort destLength, ushort destUTF8MaxLengthInBytes, char* src, int srcLength)
```

### Parameters

**** (\[byte\*]\(https\://learn.microsoft.com/dotnet/api/system.byte)): The destination buffer.**** (\[ushort]\(https\://learn.microsoft.com/dotnet/api/system.uint16)): Reference to the destination buffer's length in bytes "before" the append. Will be assigned the number of bytes appended.**** (\[ushort]\(https\://learn.microsoft.com/dotnet/api/system.uint16)): The destination buffer's length in bytes. Data will not be appended past this length.**** (\[char\*]\(https\://learn.microsoft.com/dotnet/api/system.char)): The source buffer.**** (\[int]\(https\://learn.microsoft.com/dotnet/api/system.int32)): The number of chars to read from the source.

### Returns

| Type                                                                        | Description                                                                                                                                                                                                                                |
| --------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| [CopyError](/engine/6000.7/script-reference/unity/collections/copyerror.md) | [CopyError.None](/engine/6000.7/script-reference/unity/collections/copyerror/none.md) if the append fully completes. Otherwise, returns [CopyError.Truncation](/engine/6000.7/script-reference/unity/collections/copyerror/truncation.md). |

### Remarks

Assumes the source data is valid UCS-2.

## Append(char\*, ushort, ushort, byte\*, ushort)

Appends UTF-8 text to a buffer, encoded as UCS-2.

```csharp
public static CopyError Append(char* dest, ref ushort destLength, ushort destUCS2MaxLengthInChars, byte* src, ushort srcLength)
```

### Parameters

**** (\[char\*]\(https\://learn.microsoft.com/dotnet/api/system.char)): The destination buffer.**** (\[ushort]\(https\://learn.microsoft.com/dotnet/api/system.uint16)): Reference to the destination buffer's length in chars "before" the append. Will be assigned the number of chars appended.**** (\[ushort]\(https\://learn.microsoft.com/dotnet/api/system.uint16)): The destination buffer's length in chars. Data will not be appended past this length.**** (\[byte\*]\(https\://learn.microsoft.com/dotnet/api/system.byte)): The source buffer.**** (\[ushort]\(https\://learn.microsoft.com/dotnet/api/system.uint16)): The number of bytes to read from the source.

### Returns

| Type                                                                        | Description                                                                                                                                                                                                                                |
| --------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| [CopyError](/engine/6000.7/script-reference/unity/collections/copyerror.md) | [CopyError.None](/engine/6000.7/script-reference/unity/collections/copyerror/none.md) if the append fully completes. Otherwise, returns [CopyError.Truncation](/engine/6000.7/script-reference/unity/collections/copyerror/truncation.md). |

### Remarks

Assumes the source data is valid UTF-8.
