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 a C# object type box containing various value types like integers and strings, with arrows showing boxing and unboxing.
C#

C# Object Type Usage: When and How to Use It

Practical guidance for using the C# object type: boxing and unboxing mechanics, performance tradeoffs, and safer alternatives like generics.

C# object typeboxing and unboxingtype safetygenerics
A diagram showing a light switch with true and false labels, representing C# boolean values.
C#

C# Bool Usage: Syntax, Operators, and Pitfalls

C# bool usage explained: declaration, short-circuit operators, nullable bool, method return types, and common mistakes.

C#BooleanNullableOperators
A visual comparison of a single character box and a sequence of characters representing char and string in C#.
C#

C# char vs string: When to Use Each Type

c# char vs string: Understand the differences between char and string in C#, including memory, equality, and performance, to choose the right type for your code.

C#charstringtype comparison
Editorial illustration comparing C# float, double, and decimal numeric types showing precision and range differences
C#

C# Float vs Double vs Decimal: Key Differences

Compare C# float, double, and decimal: precision, range, memory, and performance tradeoffs, plus practical guidance on choosing the right numeric type.

C# numeric typesfloating point precisiondecimal vs doubleSystem.Decimal
Comparison of C# integer types byte, short, int, and long showing their bit widths and ranges.
C#

C# Integer Types: Choosing Between byte, short, int, and long

Understand the differences between byte, short, int, and long in C#: ranges, memory footprint, overflow behavior, conversions, and when each type fits.

C#integer typesnumeric rangesoverflow
Comparison of C# integer types showing range and storage size differences.
C#

C# Integer Types Comparison: Choose the Right Type

Compare C# integer types by range, storage size, and use case. Learn when to use int, long, uint, nint, and BigInteger in your code.

C#Integer TypesNumeric TypesData Types
C# code snippet showing variable declarations with different built-in data types like int, double, and decimal, with a visual representation of memory allocation.
C#

C# Built-in Data Types: Selection Guide

A practical guide to C# built-in data types: ranges, defaults, memory behavior, and how to choose the right type for your variables.

C# data typesvalue typesreference typesnumeric types
Diagram comparing stack and heap memory allocation for value types and reference types in C#.
C#

C# Stack vs Heap: Memory Allocation Explained

Understand how C# stores value types on the stack and reference types on the heap, and how that distinction affects performance, GC pressure, and code design.

C#Memory ManagementStackHeap
Diagram contrasting value types stored on stack and reference types stored on heap with a pointer.
C#

C# Value Type vs Reference Type: Key Differences

c# value type vs reference type: Understand how C# value types and reference types behave in memory, assignment, parameter passing, and equality, and when to choose each.

C#value typesreference typesstack vs heap
Illustration comparing a C# field and a property, showing a direct storage box and a protected box with a shield representing encapsulation.
C#

C# Field vs Property: When to Use Each

c# field vs property: Understand the difference between fields and properties in C#, including syntax, encapsulation, validation, and performance tradeoffs.

C#PropertiesFieldsEncapsulation