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 comparing C# extension method syntax with static method syntax
C#

C# Extension Method vs Static Method: Key Differences

A practical comparison of C# extension methods and static methods: syntax, method resolution, null handling, discoverability, and when each approach fits.

C#Extension MethodsStatic MethodsCode Design
A syntax-highlighted C# code snippet showing a generic extension method with type parameters and constraint
C#

C# Generic Extension Method Implementation Guide

Learn how to write generic extension methods in C# to add reusable functionality to existing types while preserving type safety and avoiding common pitfalls.

C#Extension MethodsGenericsType Safety
Thumbnail representing C# extension method syntax with a this parameter binding to a type.
C#

C# Extension Method this Parameter Explained

Understand the `this` parameter in C# extension methods: syntax, method resolution, generic extension methods, and common pitfalls.

Extension MethodsC# ProgrammingStatic ClassesLINQ
Illustration showing a C# static method extended to add a new method to an existing type, with a plus sign indicating addition.
C#

C# Extension Method Declaration: Syntax, Rules, and Use

c# extension method declaration: Learn how to declare extension methods in C#: static class requirements, the `this` modifier, scoping rules, and practical implementat...

Extension MethodsC# SyntaxStatic ClassesLINQ
C# extension method concept illustrated with the this keyword extending a string type
C#

C# Extension Method Syntax and Use Cases

Learn how to write and use C# extension methods, including static class requirements, null handling, and performance considerations.

C#Extension MethodsLINQStatic Classes
Illustration of C# LINQ query with null safety mechanisms like null-conditional operator and DefaultIfEmpty.
C#

C# LINQ Null Handling: Avoiding NullReferenceException in Queries

Practical ways to handle null sources, null elements, and null properties in C# LINQ queries using null-conditional operators, DefaultIfEmpty, and safe projections.

LINQNullReferenceExceptionC# NullableNull-Conditional Operator
Illustration of multiple LINQ Where filters applied to a collection in C#
C#

C# LINQ Multiple Where Conditions: Chaining vs &&

Learn how to apply multiple Where conditions in C# LINQ, compare chaining vs &&, and understand deferred execution and performance.

LINQC#FilteringIQueryable
A diagram showing a LINQ query defined lazily and then executed when enumerated, with a visual distinction between the deferred and immediate phases.
C#

Understanding C# LINQ Deferred Execution

c# linq deferred execution: Learn how C# LINQ deferred execution works, when queries actually run, and how to avoid common pitfalls with lazy evaluation in production...

LINQC#Deferred ExecutionIEnumerable
Comparison of C# LINQ query syntax and method syntax showing two code styles
C#

C# LINQ Query Syntax vs Method Syntax

Compare C# LINQ query syntax and method syntax with examples of readability, deferred execution, and practical guidance for choosing between them.

LINQC#Query SyntaxMethod Syntax
A chain of connected nodes representing LINQ method syntax calls in C#, with one node highlighted to show a filtering step.
C#

C# LINQ Method Syntax Explained with Examples

c# linq method syntax: Understand how C# LINQ method syntax works: extension methods, lambda predicates, deferred execution, and when IEnumerable differs from IQueryable.

LINQC#IEnumerableIQueryable