# ref struct

A value type restricted to the stack so it cannot outlive the memory it refers to.

## What is **ref struct** in C#?

**ref struct** — A value type restricted to the stack so it cannot outlive the memory it refers to.

```csharp
ref struct BufferView
{
    Span<byte> bytes;
}
```

Level: Master · [More C# terms at this level](https://www.ask-codey.com/glossary/subjects/c-sharp/master)

Updated: September 27, 2026

Source: https://www.ask-codey.com/glossary/ref-struct
