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

A visual metaphor showing elements from multiple source collections being spread into a single target collection container.
C#

Using the C# Collection Expression Spread Operator

c# collection expression spread operator: Learn how the C# collection expression spread operator works, including syntax, target typing, allocation behavior, and commo...

C# 12Collection ExpressionsSpread OperatorArrays
A developer's code editor showing a C# collection expression initializing a list with square brackets and a spread operator.
C#

C# Collection Expression List Initialization

Learn how C# 12 collection expressions simplify list initialization with concise syntax, target typing, and the spread operator.

C# 12Collection ExpressionsList InitializationTarget Typing
C# collection expression syntax for array initialization showing square brackets and spread operator.
C#

C# Collection Expressions for Array Initialization

Learn how C# 12 collection expressions simplify array initialization, including target typing, spread elements, and common limitations.

C#Collection ExpressionsArray InitializationC# 12
Illustration of C# collection expression syntax showing multiple collection types being initialized.
C#

C# Collection Expression: Syntax and Examples

Learn how C# 12 collection expressions initialize arrays, lists, spans, and more with concise syntax and clear examples.

C# 12Collection ExpressionsArraysLists
Illustration of a C# array with an arrow pointing to the last element using the ^1 index-from-end syntax.
C#

C# Index from End: Using the ^ Operator

Use the C# ^ operator to access elements from the end of arrays, lists, strings, and spans. See examples, edge cases, and performance notes.

C#IndexRangeArrays
A string with a highlighted slice indicating the range operator in C#
C#

C# String Slicing with Range

c# string slicing with range: Learn how to slice strings with the C# range operator, including syntax, performance tradeoffs, and practical examples.

C#RangesStringsSpan<T>
An abstract illustration of a C# array being divided into sections by a range, representing array slicing.
C#

C# Array Slicing with Range

C# array slicing with the range operator: practical examples, performance trade-offs, and common pitfalls.

C#RangeArrayIndexing
C# code snippet showing the hat operator (^1) used to access the last element of an array.
C#

C# Hat Operator: Using Index from the End

c# hat operator: Learn how the C# hat operator (^) provides index-from-end access for arrays, lists, and spans with practical examples and performance notes.

C#Index from EndArray IndexingRange Operator
Illustration of a C# array with a caret pointing to the last element, representing the index-from-end operator.
C#

C# Index Operator: Using ^ and ^.. Syntax

c# index operator: Learn how the C# index operator (^) and range operator (..) work, with practical examples for arrays, lists, and custom types.

C#index operatorrange operatorcollections
Illustration of a C# code snippet showing array slicing with the range operator, with a highlighted segment.
C#

Using the C# Range Operator

c# range operator: Learn how the C# range operator works for slicing arrays, strings, and collections, including syntax, edge cases, and performance considerations.

C# 8Range OperatorIndexArray Slicing