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

A diagram showing C# collection initializer syntax translating into individual Add method calls on a collection
C#

C# Collection Initializer Syntax and Behavior

Understand how C# collection initializers are translated by the compiler, how dictionary indexer and Add-based syntax differ, and when null or performance pitfalls matter.

C# collectionsobject initializersList<T> initializerdictionary initializer
C# object initializer syntax shown as a code snippet with property assignments inside curly braces on a clean developer workspace
C#

C# Object Initializer Syntax and Usage

c# object initializer: Learn C# object initializer syntax, how it maps to constructors and property setters, and when it improves readability versus other initializati...

C#object initializercollection initializernamed parameters
C# object initialization code snippet showing object initializer syntax with braces
C#

C# Object Initialization Explained

Learn how C# object initialization works: object initializers, constructors, init-only properties, required members, collection initializers, and practical examples of when each approach fits.

object initializersC# syntaxconstructor overloadingimmutable objects
Illustration of a C# constructor chaining, showing a main constructor being called by another constructor via the 'this' keyword.
C#

C# Constructor Chaining with 'this'

Learn how to use the 'this' keyword to chain constructors in C#, reduce duplication, and keep initialization logic consistent.

C# constructorsthis keywordconstructor chainingobject initialization
C# code editor showing the this keyword used to access a member of the current class instance.
C#

C# this Member Access: Syntax and Use Cases

Learn how the C# this keyword refers to the current instance, resolves member access, enables constructor chaining, and where it cannot be used.

C# this keywordC# member accessinstance membersconstructor chaining
Abstract representation of the C# this keyword pointing to the current instance of an object in a class diagram.
C#

C# This Keyword: Usage and Common Pitfalls

Understand the C# this keyword: use it in constructors and extension methods, resolve name collisions, and see where it is optional, required, or forbidden.

C#this keywordobject-oriented programmingextension methods
Illustration of a static class symbol shared across multiple object instances, representing C# static members.
C#

C# Static Members Explained with Practical Examples

Understand C# static members: how static fields, methods, properties, constructors, and classes behave, when to use them, and how they differ from instance members.

static classstatic methodsstatic fieldsC# programming
Diagram showing two object instances of a class, each with its own set of instance fields, and a shared static field on the class.
C#

C# Instance Members Explained

Learn how C# instance members define per-object state and behavior through fields, properties, methods, constructors, and the this keyword.

csharpoopinstance-membersfields
Diagram of C# class with labeled member variables showing instance, static, and readonly fields.
C#

C# Member Variables Explained with Examples

Understand C# member variables: field syntax, initialization, static vs instance, readonly and const, and when properties are the better choice.

C# FieldsInstance MembersStatic MembersReadonly and Const
Abstract representation of a C# class with fields highlighted, showing structured data storage.
C#

C# Field Usage: Declaration, Initialization, and Access

Learn how to declare, initialize, and access fields in C#, including readonly and static modifiers, and when to choose fields over properties.

C# fieldsfield initializationreadonly fieldsstatic fields