All syntax guides
Short, practical guides on programming syntax, language fundamentals, and the tools developers reach for every day.
3,965 guides across 14 topics
Topics
Popular guides
Most readLatest guides
Page 340 of 397C# Memory vs Span: Choosing the Right Approach
c# memory vs span: Understand the differences between Memory<T> and Span<T> in C#, including when to use each, their runtime behavior, and practical guidance for high-...
Using C# Span with Stackalloc for Zero-Allocation Buffers
Learn how to use C# Span<T> with stackalloc for zero-allocation temporary buffers: syntax, constraints, practical examples, and when to avoid stack allocation.
Using C# stackalloc for High-Performance Buffers
Learn how to use c# stackalloc to allocate buffers on the stack, avoid heap allocations, and improve performance in high-frequency code paths.
Slicing Spans in C#
Learn how to use Span<T>.Slice to create memory views without allocations, with practical examples and performance considerations.
Using ReadOnlySpan in C# for Slicing and Validation
ReadOnlySpan in C# enables allocation-free slicing and validation of strings and buffers. Includes practical parsing examples, ref struct restrictions, and performance trade-offs.
C# Span vs Array: Choosing the Right Type
Learn the practical differences between Span<T> and arrays in C#, including memory allocation, performance, and when to use each type.
C# Span vs String: When to Use Each for Performance
Compare Span<T> and string in C# for memory efficiency and performance. Learn when to use each, how they differ, and see practical examples.
C# scoped ref: Controlling Reference Lifetimes
C# scoped ref: Learn how the scoped modifier in C# restricts reference lifetimes, prevents unsafe escapes, and improves safety with ref structs like Span<T>.
C# in vs ref vs out: Parameter Passing Explained
Learn how C# in, ref, and out parameter modifiers differ, when to use each, and how they affect method signatures and runtime behavior.
Understanding readonly ref in C#
Learn how readonly ref in C# lets you return and pass large structs by reference without mutation, reducing copies and improving performance.