# UnsafeAppendBuffer

> An unmanaged, untyped, heterogeneous buffer.

## Definition

* **Type:** Struct
* **Namespace:** [Unity.Collections.LowLevel.Unsafe](/engine/6000.7/script-reference/unity/collections/lowlevel/unsafe.md)
* **Assembly:** UnityEngine.ManagedKernelModule
* **Implements:** [INativeDisposable](/engine/6000.7/script-reference/unity/collections/inativedisposable.md), [IDisposable](https://learn.microsoft.com/dotnet/api/system.idisposable)

```csharp
public struct UnsafeAppendBuffer : INativeDisposable, IDisposable
```

## Remarks

The values written to an individual append buffer can be of different types.

## Fields

| Value                                                                                                          | Description                                                             |
| -------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------- |
| [Alignment](/engine/6000.7/script-reference/unity/collections/lowlevel/unsafe/unsafeappendbuffer/alignment.md) | The byte alignment used when allocating the internal buffer.            |
| [Allocator](/engine/6000.7/script-reference/unity/collections/lowlevel/unsafe/unsafeappendbuffer/allocator.md) | The allocator used to create the internal buffer.                       |
| [Capacity](/engine/6000.7/script-reference/unity/collections/lowlevel/unsafe/unsafeappendbuffer/capacity.md)   | The size in bytes of the internal buffer.                               |
| [Length](/engine/6000.7/script-reference/unity/collections/lowlevel/unsafe/unsafeappendbuffer/length.md)       | The size in bytes of the currently-used portion of the internal buffer. |
| [Ptr](/engine/6000.7/script-reference/unity/collections/lowlevel/unsafe/unsafeappendbuffer/ptr.md)             | The internal buffer where the content is stored.                        |

## Constructors

| Constructor                                                                                                                                                                                                                                    | Description                                                                                |
| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------ |
| [UnsafeAppendBuffer(System.Int32,System.Int32,Unity.Collections.AllocatorManager.AllocatorHandle)](/engine/6000.7/script-reference/unity/collections/lowlevel/unsafe/unsafeappendbuffer/ctor.md#unsafeappendbuffer\(int-int-allocatorhandle\)) | Initializes and returns an instance of UnsafeAppendBuffer.                                 |
| [UnsafeAppendBuffer(System.Void\*,System.Int32)](/engine/6000.7/script-reference/unity/collections/lowlevel/unsafe/unsafeappendbuffer/ctor.md#unsafeappendbuffer\(void*-int\))                                                                 | Initializes and returns an instance of UnsafeAppendBuffer that aliases an existing buffer. |

## Properties

| Property                                                                                                       | Description                                                              |
| -------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------ |
| [IsCreated](/engine/6000.7/script-reference/unity/collections/lowlevel/unsafe/unsafeappendbuffer/iscreated.md) | Whether this append buffer has been allocated (and not yet deallocated). |
| [IsEmpty](/engine/6000.7/script-reference/unity/collections/lowlevel/unsafe/unsafeappendbuffer/isempty.md)     | Whether the append buffer is empty.                                      |

## Methods

| Method                                                                                                                             | Description                                                        |
| ---------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------ |
| [Add](/engine/6000.7/script-reference/unity/collections/lowlevel/unsafe/unsafeappendbuffer/add.md)                                 | Appends an element to the end of this append buffer.               |
| [AddArray](/engine/6000.7/script-reference/unity/collections/lowlevel/unsafe/unsafeappendbuffer/addarray.md)                       | Appends the elements of a buffer to the end of this append buffer. |
| [AsReader](/engine/6000.7/script-reference/unity/collections/lowlevel/unsafe/unsafeappendbuffer/asreader.md)                       | Returns a reader for this append buffer.                           |
| [Dispose](/engine/6000.7/script-reference/unity/collections/lowlevel/unsafe/unsafeappendbuffer/dispose.md)                         | Releases all resources (memory and safety handles).                |
| [Pop](/engine/6000.7/script-reference/unity/collections/lowlevel/unsafe/unsafeappendbuffer/pop.md)                                 | Removes and copies the last element of this append buffer.         |
| [Reset](/engine/6000.7/script-reference/unity/collections/lowlevel/unsafe/unsafeappendbuffer/reset.md)                             | Sets the length to 0.                                              |
| [ResizeUninitialized](/engine/6000.7/script-reference/unity/collections/lowlevel/unsafe/unsafeappendbuffer/resizeuninitialized.md) | Sets the length in bytes.                                          |
| [SetCapacity](/engine/6000.7/script-reference/unity/collections/lowlevel/unsafe/unsafeappendbuffer/setcapacity.md)                 | Sets the size in bytes of the internal buffer.                     |

## Structs

| Struct                                                                                                                      | Description                      |
| --------------------------------------------------------------------------------------------------------------------------- | -------------------------------- |
| [UnsafeAppendBuffer.Reader](/engine/6000.7/script-reference/unity/collections/lowlevel/unsafe/unsafeappendbuffer/reader.md) | A reader for UnsafeAppendBuffer. |
