Memory and Performance in C#
Memory and Performance in C#
Section titled “Memory and Performance in C#”Every page here is directly about reducing allocations or working closer to memory and references.
| Feature | Introduced In | Why it belongs here | Guide |
|---|---|---|---|
Span<T> | C# 7.2 | Allocation-free slices over contiguous memory. | Guide |
| Implicit Span and ReadOnlySpan conversions | C# 14.0 | Reduces friction when passing arrays and spans to span-first APIs. | Guide |
| ref struct | C# 7.2 | Stack-only type foundation for Span<T>. | Guide |
| ref locals | C# 7.0 | Alias storage locations without copying values. | Guide |
| ref returns | C# 7.0 | Return references instead of copied values. | Guide |
| readonly struct | C# 7.2 | Prevent defensive copies for immutable value types. | Guide |
| Generic math | C# 11.0 | Zero-boxing numeric abstractions via static interfaces. | Guide |