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 of C# bitwise operators showing AND, OR, XOR, NOT, and shift operations on binary bits.
C#

C# Bitwise Operators: Syntax, Use Cases, and Pitfalls

Understand C# bitwise operators: &, |, ^, ~, <<, >>, with practical examples for flags, bit manipulation, and common pitfalls.

bitwise operatorsC# operatorsflags enumsinteger bit manipulation
Diagram comparing C# logical OR and bitwise OR operators with short-circuiting behavior
C#

C# || vs |: Short-Circuiting and Bitwise OR

Understand the difference between C#'s short-circuiting || and non-short-circuiting | operators, including usage, pitfalls, and performance implications.

C# operatorsshort-circuitingbitwise operationsboolean logic
Visual comparison of two C# operators showing conditional short-circuit versus eager evaluation.
C#

C# && vs & Operators: Key Differences

C# developers often confuse && and &. This article explains short-circuiting, eager evaluation, bitwise behavior, side effects, and when to use each operator.

C# operatorsshort-circuit evaluationlogical operatorsbitwise operators
Diagram showing C# logical AND and OR operators with short-circuit evaluation paths.
C#

C# && and || Operators Explained for Conditionals

Understand how C# && (AND) and || (OR) work in conditionals, including short-circuit evaluation, operator precedence, nullable Booleans, and common pitfalls to avoid.

C#logical operatorsshort-circuitconditional expressions
Illustration of C# logical operators with AND, OR, and NOT symbols on a circuit-like background representing Boolean logic.
C#

C# Logical Operators Explained with Examples

Learn how C# logical operators &&, ||, and ! work, including short-circuit behavior, precedence, and practical examples for clear conditional logic.

logical operatorsBoolean logicshort-circuit evaluationC# conditionals
Illustration of C# comparison operators, showing two code blocks compared with symbols like ==, <, and >
C#

C# Comparison Operators: Syntax and Behavior

Understand how C# comparison operators behave for numeric types, strings, nullable values, floating-point values, and custom types, including operator overloading and common pitfalls.

C# operatorsrelational operatorsequality comparisonoperator overloading
A visual comparison of prefix and postfix increment operators in C#, showing the timing of the increment relative to value usage.
C#

C# Prefix vs Postfix Increment

Understand how C#'s prefix (++i) and postfix (i++) increment operators differ, including evaluation order, return values, and practical examples.

C# operatorsincrement operatorsexpression evaluationcode readability
Diagram showing C# increment and decrement operators with prefix and postfix behavior
C#

C# Increment and Decrement Operators: Prefix vs Postfix

Understand how C# ++ and -- operators work in expressions and loops, and learn when prefix vs postfix behavior matters.

C#OperatorsIncrementDecrement
Diagram comparing checked and unchecked arithmetic overflow behavior in C# showing exception versus wrap-around.
C#

C# Checked vs Unchecked: Controlling Integer Overflow

Understand how C# checked and unchecked contexts control integer overflow, when to use each, and how they affect runtime behavior and performance.

C#integer overflowchecked contextunchecked context
Diagram showing a C# type pattern matching a base type to a derived type with a checkmark.
C#

C# Pattern Matching Type Conversion: Type Patterns

Use C# pattern matching type conversion with type patterns, switch expressions, and property patterns. Includes null handling, records, tuples, guards, and performance considerations.

pattern matchingtype patternsswitch expressionsis expression