# ArcBuffer Methods

[Type overview](/orleans/docs/api/csharp/microsoft.orleans.serialization/orleans.serialization.buffers.arcbuffer/)

## AsReadOnlySequence {#asreadonlysequence-6226926f}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.serialization/orleans.serialization.buffers.arcbuffer/methods/asreadonlysequence-6226926f/)

[Source](https://github.com/dotnet/orleans/blob/e4e752cedecc2976811db49802c7a999b1f1c704/src/Orleans.Serialization/Buffers/ArcBufferWriter.cs#L1326-L1364)

```csharp
public readonly ReadOnlySequence<byte> AsReadOnlySequence()
```

Returns a new `System.Buffers.ReadOnlySequence-1` which must not be accessed after disposing this instance.

## CopyTo(Span&lt;byte&gt;) {#copyto-system-span-byte-715fc94f}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.serialization/orleans.serialization.buffers.arcbuffer/methods/copyto-system-span-byte-715fc94f/)

[Source](https://github.com/dotnet/orleans/blob/e4e752cedecc2976811db49802c7a999b1f1c704/src/Orleans.Serialization/Buffers/ArcBufferWriter.cs)

```csharp
public readonly int CopyTo(Span<byte> output)
```

Copies the contents of this writer to a span.

### Parameters

- `output` (`Span<byte>`)

## CopyTo(ArcBufferWriter) {#copyto-orleans-serialization-buffers-arcbufferwriter-bf5f0375}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.serialization/orleans.serialization.buffers.arcbuffer/methods/copyto-orleans-serialization-buffers-arcbufferwriter-bf5f0375/)

[Source](https://github.com/dotnet/orleans/blob/e4e752cedecc2976811db49802c7a999b1f1c704/src/Orleans.Serialization/Buffers/ArcBufferWriter.cs)

```csharp
public readonly void CopyTo(ArcBufferWriter output)
```

Copies the contents of this writer to a pooled buffer.

### Parameters

- `output` (`ArcBufferWriter`)

## CopyTo(TBufferWriter) {#copyto-1-ref-tbufferwriter-fa745b65}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.serialization/orleans.serialization.buffers.arcbuffer/methods/copyto-1-ref-tbufferwriter-fa745b65/)

[Source](https://github.com/dotnet/orleans/blob/e4e752cedecc2976811db49802c7a999b1f1c704/src/Orleans.Serialization/Buffers/ArcBufferWriter.cs)

```csharp
public readonly void CopyTo<TBufferWriter>(ref TBufferWriter output)
```

Copies the contents of this writer to a buffer writer.

### Parameters

- `output` (`TBufferWriter`)

## Dispose {#dispose-910101dc}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.serialization/orleans.serialization.buffers.arcbuffer/methods/dispose-910101dc/)

[Source](https://github.com/dotnet/orleans/blob/e4e752cedecc2976811db49802c7a999b1f1c704/src/Orleans.Serialization/Buffers/ArcBufferWriter.cs#L1482-L1489)

```csharp
public void Dispose()
```

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

## GetEnumerator {#getenumerator-ba472329}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.serialization/orleans.serialization.buffers.arcbuffer/methods/getenumerator-ba472329/)

[Source](https://github.com/dotnet/orleans/blob/e4e752cedecc2976811db49802c7a999b1f1c704/src/Orleans.Serialization/Buffers/ArcBufferWriter.cs#L1495)

```csharp
public readonly SpanEnumerator GetEnumerator()
```

Returns an enumerator which can be used to enumerate the span segments referenced by this instance.

### Returns

An enumerator for the data contained in this instance.

## Pin {#pin-47da89d4}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.serialization/orleans.serialization.buffers.arcbuffer/methods/pin-47da89d4/)

[Source](https://github.com/dotnet/orleans/blob/e4e752cedecc2976811db49802c7a999b1f1c704/src/Orleans.Serialization/Buffers/ArcBufferWriter.cs#L1443-L1456)

```csharp
public readonly void Pin()
```

Pins this slice, preventing the referenced pages from being returned to the pool.

## Slice(int) {#slice-int-85a0e3b5}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.serialization/orleans.serialization.buffers.arcbuffer/methods/slice-int-85a0e3b5/)

[Source](https://github.com/dotnet/orleans/blob/e4e752cedecc2976811db49802c7a999b1f1c704/src/Orleans.Serialization/Buffers/ArcBufferWriter.cs#L1384)

```csharp
public readonly ArcBuffer Slice(int offset)
```

### Parameters

- `offset` (`int`)

## Slice(int, int) {#slice-int-int-064cfc30}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.serialization/orleans.serialization.buffers.arcbuffer/methods/slice-int-int-064cfc30/)

[Source](https://github.com/dotnet/orleans/blob/e4e752cedecc2976811db49802c7a999b1f1c704/src/Orleans.Serialization/Buffers/ArcBufferWriter.cs#L1388-L1390)

```csharp
public readonly ArcBuffer Slice(int offset, int length)
```

### Parameters

- `offset` (`int`)
- `length` (`int`)

## ToArray {#toarray-db402d55}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.serialization/orleans.serialization.buffers.arcbuffer/methods/toarray-db402d55/)

[Source](https://github.com/dotnet/orleans/blob/e4e752cedecc2976811db49802c7a999b1f1c704/src/Orleans.Serialization/Buffers/ArcBufferWriter.cs#L1373-L1376)

```csharp
public readonly byte[] ToArray()
```

Returns the data which has been written as an array.

### Returns

The data which has been written.

## Unpin {#unpin-c8d9227f}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.serialization/orleans.serialization.buffers.arcbuffer/methods/unpin-c8d9227f/)

[Source](https://github.com/dotnet/orleans/blob/e4e752cedecc2976811db49802c7a999b1f1c704/src/Orleans.Serialization/Buffers/ArcBufferWriter.cs#L1463-L1477)

```csharp
public void Unpin()
```

Unpins this slice, allowing the referenced pages to be returned to the pool.

## UnsafeSlice(int, int) {#unsafeslice-int-int-10efb192}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.serialization/orleans.serialization.buffers.arcbuffer/methods/unsafeslice-int-int-10efb192/)

[Source](https://github.com/dotnet/orleans/blob/e4e752cedecc2976811db49802c7a999b1f1c704/src/Orleans.Serialization/Buffers/ArcBufferWriter.cs#L1396-L1435)

```csharp
public readonly ArcBuffer UnsafeSlice(int offset, int length)
```

### Parameters

- `offset` (`int`)
- `length` (`int`)
