YUNOVA · C# · Module 12: Advanced C#
Span<T> and memory performance
Span<T> and memory performance
Key points
- Span<T> is a view over contiguous memory without copying it.
- Slicing a span avoids new allocations for substrings or arrays.
- Span is a ref struct, so it cannot be stored on the heap; Memory<T> can.