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

Illustration of C# List<T> operations showing add, remove, and iterate actions.
C#

C# List Usage: Practical Guide to List<T> Operations

c# list usage: Learn how to use List<T> in C#: creation, adding, removing, iterating, sorting, and performance considerations for real-world code.

C# ListList<T>CollectionsLINQ
Illustration of C# is not null pattern matching a null reference with a shield indicating safety.
C#

C# is not null: Pattern Matching for Null Checks

The C# is not null pattern is a concise, type-safe way to check for null values and avoids overloaded operator behavior. This article shows how it differs from != null and when to use it.

C#Null CheckPattern MatchingC# 9
Illustration of a C# code snippet using the is null pattern to check for null references.
C#

C# is null: Pattern Matching for Null Checks

c# is null: Learn how to use the `is null` pattern in C# for clear, reliable null checks, and see how it compares to other null-checking approaches.

C#null checkingpattern matchingnull safety
Illustration of C# null pattern matching with a magnifying glass over null and non-null values.
C#

C# Null Pattern Matching: Syntax and Practical Usage

Learn how C# null pattern matching can simplify null checks, combine with property patterns, and make conditional logic cleaner.

C#pattern matchingnull handlingswitch expressions
Illustration of the C# null forgiving operator suppressing a null warning in code.
C#

C# Null Forgiving Operator: Usage and Pitfalls

c# null forgiving operator: Learn how the C# null forgiving operator suppresses nullable warnings, when to use it, and common mistakes to avoid.

C#nullable reference typesnull safetyoperator
A C# code snippet with a guard symbol representing null check patterns and nullable types.
C#

C# Null Check: Syntax, Patterns, and Pitfalls

Learn how to check for null in C# using equality operators, pattern matching, nullable types, and null-conditional operators. Avoid common pitfalls with practical examples.

C#Null CheckingNullable TypesPattern Matching
Diagram of a C# nullable value property showing a question mark and two states: a number and an empty box.
C#

C# Nullable Value Property: Syntax and Usage

Learn how to declare nullable value properties in C#, check for values with HasValue and pattern matching, and handle missing values safely with ??, GetValueOrDefault, and null assignment.

C#nullable typesvalue typesnull handling
Diagram showing a nullable value being resolved to either its underlying value or a default fallback using GetValueOrDefault.
C#

C# Nullable GetValueOrDefault: Usage and Behavior

Understand C# Nullable<T>.GetValueOrDefault: its overloads, behavior with HasValue, comparison with ??, and usage in LINQ and production code.

C#Nullable.NETGetValueOrDefault
A technical illustration showing a C# reference type container with a question mark badge, representing nullable reference type annotations and compile-time null safety analysis.
C#

C# Nullable Reference Type: Enabling and Using It Safely

c# nullable reference type: Learn how to enable and use C# nullable reference types, understand compiler warnings, and migrate existing codebases safely.

nullable reference typesnull safetycompiler warningsC# type system
Diagram showing a nullable value type box with a value and a flag indicating whether a value is present.
C#

C# Nullable Value Type: Syntax and Usage

Learn how to declare and use C# nullable value types with Nullable<T>, including HasValue, Value, GetValueOrDefault, and pattern matching.

nullable value typeC# syntaxNullable<T>null handling