Pages

Topics

Tools

↑↓navigate↵openescclose

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

Latest guides

Illustration of an array being reversed in C# with arrows indicating element swapping.
C#

C# Reverse Array: Methods and Performance

Learn how to reverse arrays in C# using Array.Reverse, LINQ, and manual loops, with performance considerations and common pitfalls.

Array.ReverseLINQC# arraysperformance
Illustration of sorting an array in C# with arrows showing order and code elements.
C#

C# Array Sort Method Explained with Examples

Learn how C#'s Array.Sort method works, including overloads, custom comparers, LINQ OrderBy, stability, performance, and common edge cases.

Array.SortC# SortingLINQ OrderByComparer
Illustration of sorting an array of numbers in C# with ascending order.
C#

C# Array Sorting: Array.Sort vs LINQ OrderBy

Learn how to sort C# arrays with Array.Sort and LINQ OrderBy, including custom comparers and performance tradeoffs.

C#ArraySortingLINQ
Illustration of copying an array in C# showing source and destination arrays with a copy operation.
C#

C# Array Copy Method: Choosing the Right Approach

c# array copy method: Learn how to copy arrays in C# using Array.Copy, Clone, CopyTo, and LINQ ToArray, and understand shallow vs deep copy behavior.

C#ArraysArray.CopyClone
Two arrays side by side, with an arrow indicating a copy operation from one to the other, representing C# array copy methods.
C#

C# Array Copy: Methods, Performance, and Pitfalls

Learn how to copy arrays in C# using Array.Copy, Clone, LINQ, and manual loops. Understand shallow vs deep copy and choose the right method.

C#Array.CopyArray.CloneLINQ ToArray
Diagram showing a foreach loop iterating over an array in C# with elements being processed sequentially.
C#

C# Array foreach: Syntax and Usage

Learn how to use foreach with arrays in C#: syntax, behavior, limitations, and performance considerations with practical code examples.

C#foreacharraysiteration
Diagram showing a for loop and a foreach loop iterating over a C# array, with index access on the left and direct element access on the right.
C#

C# Array Loops: for vs foreach and More

Learn how to iterate over C# arrays effectively. Compare for and foreach, handle multidimensional and jagged arrays, and avoid common pitfalls.

C#Array Iterationforeachfor Loop
Illustration of a C# array with its Length property highlighted, showing the number of elements.
C#

C# Array Length: Property, Pitfalls, and Performance

Learn how to use the Length property on C# arrays, handle multi-dimensional and jagged arrays, avoid common mistakes, and understand performance implications.

C#ArraysLength PropertyCollections
Diagram showing direct assignment to an array element in C# with alternatives like Span<T> and List<T>.
C#

C# Modify Array Values: Direct Assignment and Alternatives

Learn how to modify array values in C# using direct indexing, Array.Copy, Span<T>, and List<T>, including performance tradeoffs and common pitfalls.

C# arraysarray indexingSpan<T>List<T>
Diagram showing different C# array initialization syntax forms with a visual representation of an array structure.
C#

C# Array Initialization: Syntax and Common Patterns

C# arrays store a fixed number of elements. Learn common initialization forms, default values, rectangular and jagged arrays, C# 12 collection expressions, and how to choose between arrays and List<T>.

ArrayC# Syntax.NETInitialization