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 showing a C# property with a public getter and private setter, illustrating controlled assignment.
C#

C# Private Set: Syntax and Use Cases

C# private set accessor: syntax, constructor usage, and when to prefer init or readonly fields.

C#PropertiesEncapsulationAccess Modifiers
Diagram showing a C# property with get and set accessors controlling access to a private field.
C#

C# Getter Setter: Properties and Accessors

Learn how to use C# getter and setter accessors in properties, including auto-properties, validation, access modifiers, and performance considerations.

C#PropertiesAccessorsAuto-Properties
Diagram showing a C# auto property declaration with compiler-generated backing field
C#

C# Auto Property: Syntax and Usage Explained

Learn how C# auto-implemented properties work: syntax, initialization, access modifiers, and when to use a manual property instead.

C# propertiesauto-implemented propertiesproperty initializationC# syntax
Diagram illustrating C# auto-implemented property with compiler-generated backing field and get/set accessors.
C#

C# Auto-Implemented Property: Syntax and Usage

Learn how C# auto-implemented properties work, how to initialize them, how read-only and init accessors behave, and when to use manual properties instead.

C#PropertiesAuto-Implemented PropertiesC# Syntax
Illustration of a C# property with get and set accessors, showing a lock and key metaphor for encapsulation.
C#

C# Get Set: Property Accessors Explained

Learn how C# get and set accessors work, including auto-properties, access modifiers, validation, computed properties, and performance considerations.

C# propertiesget accessorset accessorauto-properties
Diagram showing C# property accessor patterns with backing fields and validation logic.
C#

C# Property Usage: Patterns and Pitfalls

c# property usage: Learn practical C# property usage: auto-implemented properties, computed values, validation, performance costs, and when to prefer methods.

C# propertiesauto-implemented propertiescomputed propertiesproperty validation
A C# class diagram showing a private field behind a public property, illustrating encapsulation boundaries.
C#

C# Encapsulation: Hiding State Behind Clear Boundaries

Learn how to use C# access modifiers, properties, init accessors, and read-only collection views to keep an object's state safe and its interface clear.

encapsulationaccess modifierspropertiesC# design
Diagram showing C# access modifier scope from public to private, with a class and its members
C#

C# Access Modifier Scope: How Visibility Works

Understand how C# access modifiers control member visibility and scope, with practical examples and guidance for choosing the right level.

access modifiersC# visibilityencapsulationC# scope
Diagram showing C# protected access limited to derived classes and internal access limited to the same assembly.
C#

C# Protected vs Internal: Choosing the Right Access Modifier

Learn how C# protected and internal access modifiers differ, what the combined forms protected internal and private protected mean, and when to use each in real code.

C#access modifiersencapsulationobject-oriented programming
Illustration of C# public and private access modifiers showing visibility boundaries between classes.
C#

C# Public vs Private: When to Use Each

Understand the difference between public and private in C#, when to use each, and how they affect encapsulation and API design.

C#access modifiersencapsulationobject-oriented programming