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 LINQ ThenBy chaining secondary sort keys after OrderBy in C#.
C#

C# LINQ ThenBy: Sorting by Multiple Keys

Learn how to use C# LINQ ThenBy to sort data by multiple keys, handle descending order, and avoid common pitfalls.

LINQC#SortingThenBy
A descending arrow over a set of ordered cards representing C# LINQ OrderByDescending sorting.
C#

C# LINQ OrderByDescending: Sorting in Descending Order

Learn how to sort collections in descending order with C# LINQ OrderByDescending: syntax, key selectors, chained ThenByDescending sorts, null handling, and performance considerations.

LINQC#SortingOrderByDescending
Illustration of C# LINQ OrderBy sorting a collection of objects into ascending order
C#

C# LINQ OrderBy: Syntax, Examples, and Sorting Behavior

Learn how to use C# LINQ OrderBy to sort collections, including OrderByDescending, ThenBy for multiple keys, custom comparers, deferred execution, and performance.

LINQSortingOrderByC# Collections
A diagram showing how C# LINQ SelectMany flattens nested collections into a single sequence
C#

C# LINQ SelectMany: Flattening Nested Collections

Learn how C# LINQ SelectMany flattens nested collections into a single sequence, with syntax examples and performance tradeoffs.

LINQC#IEnumerableData Transformation
Diagram showing LINQ Select transforming a sequence of objects into a projected output sequence.
C#

C# LINQ Select: Syntax, Examples, and Pitfalls

Learn how to use C# LINQ Select to project data, including syntax, index usage, deferred execution, and common pitfalls.

LINQC#SelectProjection
A visual representation of a C# LINQ Where filter selecting items from a collection, with a funnel metaphor.
C#

How to Use Where in C# LINQ

Learn how the Where method filters sequences in C# LINQ, covering syntax, predicate behavior, deferred execution, and practical performance considerations.

LINQC#FilteringQuery Syntax
A visual metaphor of querying a collection with LINQ, showing a pipeline of data transformation steps.
C#

C# LINQ Usage: Practical Patterns and Performance

Practical LINQ usage in C#: query vs method syntax, deferred execution, common operations, and performance tradeoffs for real applications.

LINQC#.NETQuery Syntax
A diagram showing a publisher class raising an event that multiple subscriber classes handle, illustrating the C# publisher subscriber pattern.
C#

C# Publisher Subscriber Pattern: Events in Practice

c# publisher subscriber pattern: Learn how the C# publisher subscriber pattern works with events and delegates, including exception handling, memory leaks, and threadi...

C#EventsDelegatesDesign Patterns
Illustration of a C# event being safely invoked with a null-conditional operator, showing a delegate reference being checked before invocation.
C#

C# Event Null Check: Safe Invocation Patterns

Learn how to safely check and invoke C# events to avoid NullReferenceException, including the null-conditional operator, race conditions, and custom accessors.

C# eventsNullReferenceExceptionThread safetyDelegate invocation
Diagram showing a C# event being raised from a class to multiple subscriber methods.
C#

Raising Events in C#: Syntax, Safety, and Common Pitfalls

Raising events in C#: declare and invoke them safely, pass custom event arguments, handle no subscribers, and avoid common pitfalls that break production code.

C# eventsevent invocationdelegatesthread safety