Pages

Topics

Tools

↑↓navigate↵openescclose

C# guides

Every published C# guide, newest first, with practical examples you can copy into your own project.

3,965 guides across 14 topics

Topics

Latest C# guides

Illustration of C# string interpolation showing a formatted string with embedded expressions being resolved to output text.
C#

C# String Interpolation: Syntax, Performance, and Edge Cases

Learn C# string interpolation syntax, compiled behavior, format specifiers, performance characteristics, and edge cases that matter in production code.

C#string interpolation.NETstring formatting
A visual comparison of C# string concatenation methods showing immutable string pieces being copied into a new combined block versus a single growing buffer.
C#

C# String Concatenation: Choosing the Right Approach

Learn how C# string concatenation works under the hood, compare the + operator, String.Concat, interpolation, and StringBuilder, and choose the right approach for your scenario.

string concatenationStringBuilderstring interpolationC# performance
Diagram illustrating C# string immutability and concatenation performance
C#

C# String Usage: Methods, Immutability, and Performance

Explore practical C# string usage: common methods, immutability, concatenation, interpolation, comparison, and performance tradeoffs.

C# stringsStringBuilderstring interpolationstring immutability
A visual metaphor showing a Span<T> view pointing into an array, illustrating zero-allocation slicing in C#.
C#

Using C# Span with Arrays for Zero-Allocation Slicing

c# span with arrays: Learn how to use Span<T> with arrays in C# to slice, modify, and pass array data without allocating new memory, and understand the ref struct limi...

C#Span<T>ArraysMemory Management
Illustration of ArraySegment<T> representing a slice of an array with offset and count in C#
C#

Using ArraySegment in C# to Slice Arrays Without Copying

ArraySegment<T> in C#: wrap part of an array without copying, read Offset and Count, pass slices to methods, and see where Span<T> is the better choice.

ArraySegmentC# ArraysMemory ManagementSpan<T>
Side-by-side comparison of a fixed-size C# array and a dynamic List<T> collection
C#

C# Array vs List: Choosing the Right Collection Type

c# array vs list: Compare C# arrays and List<T> for fixed-size and dynamic collections, covering memory, performance, API differences, and when each type fits best.

arraysList<T>collectionsperformance
Comparison of C# multidimensional array and jagged array memory layout
C#

C# Multidimensional Array vs Jagged Array: Key Differences

Compare C# multidimensional and jagged arrays: syntax, memory layout, performance, and when to choose each for your code.

C# arraysjagged arraymultidimensional arrayC# performance
Illustration of a jagged array as an array of arrays with varying lengths
C#

C# Jagged Array: Syntax, Usage, and Performance

C# jagged array: Learn how to declare, initialize, and iterate C# jagged arrays, understand their memory layout, and see when they outperform multidimensional arrays.

C#arraysjagged arraysmultidimensional arrays
Diagram showing a two-dimensional array as a grid of cells with row and column indices, in a clean software engineering style.
C#

C# Two-Dimensional Array: Syntax, Usage, and Performance

Learn how to declare, initialize, and access two-dimensional arrays in C#. Compare multidimensional and jagged arrays, and understand performance trade-offs.

C#multidimensional arraysjagged arraysmemory layout
Diagram showing a two-dimensional C# array as a grid of cells with rows and columns visually distinct and index labels on the edges
C#

C# Multidimensional Array: Syntax and Usage

Learn how to declare, initialize, and iterate C# multidimensional arrays, including rectangular vs jagged arrays and performance tradeoffs.

C#arraysjagged arraysdata structures