Last Updated: May 17, 2026
Span<T> and Memory<T> are how modern C# describes a region of contiguous memory without allocating a new one. They let you slice arrays, strings, and native buffers into views, pass those views around, and parse or transform them in place. This lesson focuses on the memory model: what a span actually is at the byte level, why Span<T> is restricted to the stack, when Memory<T> is the right escape hatch, and the lifetime rules the compiler enforces so neither type ever dangles.