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,965 guides across 14 topics

Topics

Latest guides

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
C# class diagram showing fields and properties with access modifiers
C#

C# Member Variable Usage: Fields, Access, and Initialization

A practical guide to C# member variables and fields: declaration, access modifiers, initialization, static vs instance, readonly, const, and properties.

C# fieldsmember variablesclass designaccess modifiers
A diagram showing local variable scope and lifetime in a C# method, with a var declaration and a closure capturing a variable.
C#

C# Local Variable Usage: Types, Scope, and Pitfalls

Understand C# local variable usage: explicit types vs var, scope, definite assignment, closures in loops, and common pitfalls for maintainable code.

C#local variablesvar keywordvariable scope
Diagram comparing compile-time const constants with runtime static readonly constants in C#
C#

C# Static Readonly Usage: Syntax and Tradeoffs

c# static readonly usage: Learn how static readonly fields work in C#, how they differ from const, and when to use them for runtime constants.

C#static readonlyconst vs readonlyC# fields
Illustration comparing C# const and readonly, showing compile-time and runtime constant behavior.
C#

C# const vs readonly: Key Differences and Usage

c# const vs readonly: Understand the differences between C# const and readonly, including compile-time vs runtime behavior, usage scenarios, and performance implications.

C#constreadonlycompile-time
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