# ArcBufferPage Methods

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

## Advance(int) {#advance-int-da0ea194}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.serialization/orleans.serialization.buffers.arcbufferpage/methods/advance-int-da0ea194/)

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

```csharp
public void Advance(int bytes)
```

Increases the number of bytes written to the page by the provided amount.

### Parameters

- `bytes` (`int`): The number of bytes to increase the length of this page by.

## AsArraySegment(int, int) {#asarraysegment-int-int-b235ba93}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.serialization/orleans.serialization.buffers.arcbufferpage/methods/asarraysegment-int-int-b235ba93/)

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

```csharp
public ArraySegment<byte> AsArraySegment(int offset, int length)
```

Returns an array segment pointing to the underlying array, starting from the provided offset, and having the provided length.

### Parameters

- `offset` (`int`): The offset into the array that the array segment starts from.
- `length` (`int`): The length of the array segment.

### Returns

The array segment.

## AsMemory(int) {#asmemory-int-0ac4e650}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.serialization/orleans.serialization.buffers.arcbufferpage/methods/asmemory-int-0ac4e650/)

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

```csharp
public Memory<byte> AsMemory(int offset)
```

Creates a new memory region over the portion of the target page beginning at a specified position.

### Parameters

- `offset` (`int`): The offset into the array to return memory from.

### Returns

The memory region.

## AsMemory(int, int) {#asmemory-int-int-cd84e55d}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.serialization/orleans.serialization.buffers.arcbufferpage/methods/asmemory-int-int-cd84e55d/)

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

```csharp
public Memory<byte> AsMemory(int offset, int length)
```

Creates a new memory region over the portion of the target page beginning at a specified position with a specified length.

### Parameters

- `offset` (`int`): The offset into the array that the memory region starts from.
- `length` (`int`): The length of the memory region.

### Returns

The memory region.

## AsSpan(int) {#asspan-int-1994822a}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.serialization/orleans.serialization.buffers.arcbufferpage/methods/asspan-int-1994822a/)

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

```csharp
public Span<byte> AsSpan(int offset)
```

Gets a span pointing to the underlying array, starting from the provided offset.

### Parameters

- `offset` (`int`): The offset.

### Returns

The span.

## AsSpan(int, int) {#asspan-int-int-32a51453}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.serialization/orleans.serialization.buffers.arcbufferpage/methods/asspan-int-int-32a51453/)

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

```csharp
public Span<byte> AsSpan(int offset, int length)
```

Gets a span pointing to the underlying array, starting from the provided offset.

### Parameters

- `offset` (`int`): The offset.
- `length` (`int`): The length.

### Returns

The span.

## CheckValidity(int) {#checkvalidity-int-b48e961a}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.serialization/orleans.serialization.buffers.arcbufferpage/methods/checkvalidity-int-b48e961a/)

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

```csharp
public void CheckValidity(int token)
```

Throws if the provided `token` does not match the page's [ArcBufferPage](/orleans/docs/api/csharp/microsoft.orleans.serialization/orleans.serialization.buffers.arcbufferpage/).

### Parameters

- `token` (`int`): The token, which must match the page's [ArcBufferPage](/orleans/docs/api/csharp/microsoft.orleans.serialization/orleans.serialization.buffers.arcbufferpage/).

## Pin(int) {#pin-int-486fe8e1}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.serialization/orleans.serialization.buffers.arcbufferpage/methods/pin-int-486fe8e1/)

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

```csharp
public void Pin(int token)
```

Pins this page to prevent it from being returned to the page pool.

### Parameters

- `token` (`int`): The token, which must match the page's [ArcBufferPage](/orleans/docs/api/csharp/microsoft.orleans.serialization/orleans.serialization.buffers.arcbufferpage/) for this operation to be allowed.

## ResizeLargeSegment(int) {#resizelargesegment-int-fe6ee5d5}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.serialization/orleans.serialization.buffers.arcbufferpage/methods/resizelargesegment-int-fe6ee5d5/)

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

```csharp
public void ResizeLargeSegment(int length)
```

### Parameters

- `length` (`int`)

## SetNext(ArcBufferPage, int) {#setnext-orleans-serialization-buffers-arcbufferpage-int-aff1defd}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.serialization/orleans.serialization.buffers.arcbufferpage/methods/setnext-orleans-serialization-buffers-arcbufferpage-int-aff1defd/)

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

```csharp
public void SetNext(ArcBufferPage next, int token)
```

Sets the next page in the sequence.

### Parameters

- `next` (`ArcBufferPage`): The next page in the sequence.
- `token` (`int`): The token, which must match the page's [ArcBufferPage](/orleans/docs/api/csharp/microsoft.orleans.serialization/orleans.serialization.buffers.arcbufferpage/) for this operation to be allowed.

## Unpin(int) {#unpin-int-6dc9fcae}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.serialization/orleans.serialization.buffers.arcbufferpage/methods/unpin-int-6dc9fcae/)

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

```csharp
public void Unpin(int token)
```

Unpins this page, allowing it to be returned to the page pool.

### Parameters

- `token` (`int`): The token, which must match the page's [ArcBufferPage](/orleans/docs/api/csharp/microsoft.orleans.serialization/orleans.serialization.buffers.arcbufferpage/) for this operation to be allowed.
