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

Diagram showing C# LINQ query syntax translating to method calls with deferred execution.
C#

C# LINQ Query Syntax: A Practical Guide

Understand C# LINQ query syntax with practical examples, translation to method calls, and guidance on choosing between query and method syntax.

LINQQuery SyntaxC# ProgrammingDeferred Execution
Diagram showing a LINQ Lookup mapping one key to multiple values in C#
C#

Using Lookup in C# LINQ for One-to-Many Maps

Learn how to create and use a C# LINQ Lookup for one-to-many key mappings, and when it fits better than Dictionary or GroupBy.

LINQC#LookupDictionary
Diagram showing LINQ query results being converted into a HashSet in C#
C#

C# LINQ ToHashSet: Convert Query Results to a HashSet

See how C# LINQ's ToHashSet() converts query results into a HashSet, how it differs from ToList and ToArray, and how to avoid common pitfalls with comparers, order, and duplicates.

C#LINQHashSetCollections
Illustration of converting a list of objects into a dictionary using LINQ ToDictionary in C#.
C#

C# LINQ ToDictionary: Syntax, Edge Cases, and Performance

Learn how to use LINQ ToDictionary in C# to convert sequences into dictionaries, handle duplicate keys, and understand performance implications.

LINQDictionaryC#Exception Handling
Diagram showing an IEnumerable sequence being converted into a compact array using LINQ ToArray method.
C#

C# LINQ ToArray: Usage and Performance

Learn how C# LINQ ToArray materializes sequences into arrays, when to use it, and what it can cost in memory and performance.

LINQToArrayC#IEnumerable
C# LINQ ToList method converting an IEnumerable to a List, with a visual representation of materialization and memory allocation.
C#

C# LINQ ToList: Materialization and Practical Use

Understand what ToList() does in C# LINQ: how it materializes queries, its performance tradeoffs, and when to use it instead of deferred execution.

LINQC#ListDeferred Execution
Illustration of a C# LINQ Aggregate operation reducing a collection to a single value.
C#

How to Use LINQ Aggregate in C#

Learn how to use the LINQ Aggregate method in C# for custom reductions, including seed values, string concatenation, and performance considerations.

LINQC#Functional ProgrammingCollections
Illustration of two arrays being compared with a checkmark, representing C# LINQ SequenceEqual.
C#

C# LINQ SequenceEqual: Compare Sequences Correctly

c# linq sequenceequal: Learn how SequenceEqual works in C# LINQ, when to use it, its runtime behavior, and how to compare sequences with custom equality.

C#LINQSequenceEqualCollection Comparison
Illustration of a horizontal row of numbered blocks being reversed in order, representing the C# LINQ Reverse method.
C#

C# LINQ Reverse: Reversing Sequences

c# linq reverse: Learn how LINQ Reverse() works in C#: its deferred execution behavior, buffering cost, and when to choose it over in-place reversal methods.

LINQC#IEnumerableDeferred Execution
Illustration of a horizontal sequence of blocks with one element added at the start and one at the end, representing LINQ Append and Prepend
C#

C# LINQ Append and Prepend: Adding Elements to Sequences

c# linq append prepend: Understand C# LINQ Append and Prepend: their deferred execution behavior, chaining patterns, performance tradeoffs, and when to prefer Concat o...

LINQC#IEnumerableDeferred Execution