Pages

Topics

Tools

↑↓navigate↵openescclose

All syntax guides

Short, practical guides on programming syntax, language fundamentals, and the tools developers reach for every day.

3,980 guides across 14 topics

Topics

Latest guides

Illustration of a readonly field in C# with a lock symbol representing immutability
C#

C# readonly Keyword Usage: Fields, Structs, and ref readonly Returns

Learn how the C# readonly keyword works for fields, structs, and ref readonly returns, with practical examples and common mistakes to avoid.

readonlyC# fieldsreadonly structsimmutability
A visual representation of a C# const keyword being substituted at compile time, showing a literal value embedded in code.
C#

C# const keyword usage: Compile-Time Constants

c# const keyword usage: Learn how the const keyword works in C#, its compile-time nature, differences from readonly, and when to use it effectively.

constcompile-time constantsreadonlyC# language
Diagram comparing C# object and dynamic type resolution at compile time and runtime.
C#

C# object vs dynamic: Key Differences and Use Cases

Compare C# object and dynamic: understand compile-time vs runtime behavior, performance costs, and when to use each for flexible code.

C#dynamicobjecttype system
Illustration comparing C# var and dynamic type declarations, showing compile-time vs runtime type resolution.
C#

C# var vs dynamic: What's the Difference?

Understand the differences between C# var and dynamic, including compile-time type inference, runtime binding, type safety, and when to use each for clearer, more maintainable code.

C#type inferencedynamic typingvar keyword
Editorial illustration comparing C# var compile-time type inference with object base-type boxing, showing a typed variable next to a boxed value.
C#

c# var vs object: Static Type vs Base Type

c# var vs object compared: compile-time type inference against the object base type, boxing and unboxing, casting rules, and which declaration fits.

C#type inferenceboxingstatic typing
Illustration of C# var keyword inferring type from assigned expression
C#

C# var Type Inference: When to Use It and When to Avoid

Understand how C# var infers types at compile time, when implicit typing improves readability, and when explicit types are clearer.

C#type inferencevar keywordcompiler
Illustration of C# var keyword usage showing type inference from a variable declaration to a concrete type
C#

C# var Keyword Usage: Type Inference Explained

C# var declares a local variable without spelling out the type. Learn how type inference works, when var helps with LINQ and anonymous types, and when explicit types are clearer.

C#Type InferenceAnonymous TypesLINQ
Diagram showing a variable being declared and then initialized with a value, highlighting the two-step process in C#.
C#

C# Variable Declaration vs Initialization

Understand the difference between declaring and initializing variables in C#, including default values, definite assignment, var inference, nullable reference types, and field initialization.

C#variable declarationvariable initializationnullability
Illustration of C# variable initialization showing default values and assignment rules.
C#

C# Variable Initialization: Rules and Defaults

C# initialization rules: default field and array values, definite assignment for locals, CS0165, default(T), and how ref/out arguments must be set.

C#variable initializationdefault valuesdefinite assignment
Illustration of C# variable declaration showing type, name, and value assignment in a code editor.
C#

C# Variable Declaration: Syntax and Practical Usage

How to declare C# variables: type-then-name syntax, var vs explicit types, nullable annotations, default values, and block scope rules with examples.

variable declarationvar keywordnullable typesC# syntax