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 base class method being overridden by a derived class in C#
C#

C# Method Overriding: Syntax, Behavior, and Pitfalls

Understand C# method overriding with practical code examples covering virtual and override keywords, runtime dispatch, base calls, and common mistakes.

C#PolymorphismVirtual MethodsInheritance
Diagram comparing C# new and override behavior in inheritance, showing method resolution through base class references.
C#

C# new vs override: Choosing Between Method Hiding and Overriding

Understand the difference between the C# new and override keywords, when to use each, and how they affect polymorphism and runtime behavior.

C#inheritancemethod hidingoverride
Diagram showing a base class method being hidden by a derived class method with the new modifier in C#
C#

C# New Method Hiding: Syntax and Runtime Behavior

Understand C# method hiding with the new modifier: syntax, runtime dispatch behavior, differences from overriding, and when hiding is a deliberate design choice.

C#method hidinginheritancepolymorphism
A diagram showing a base class method marked virtual and a derived class method marked override, with an arrow indicating dynamic dispatch at runtime.
C#

C# virtual vs override: What Each Modifier Does

The difference between C# virtual and override, when to use each, and how they affect method dispatch in derived classes.

virtualoverridepolymorphisminheritance
Diagram showing a base class method being overridden by a derived class with the override keyword.
C#

C# Override Keyword: How to Use It

Learn how the C# override keyword works with virtual methods, when to use it instead of new, and how to handle base calls, sealing, and overriding object members.

C#inheritancepolymorphismvirtual methods
Diagram showing a base class method marked virtual being overridden by a derived class implementation.
C#

c# virtual keyword: How Overridable Members Work

Learn how the c# virtual keyword enables method overriding and polymorphism, including syntax, runtime dispatch, and common design pitfalls.

virtual methodspolymorphismmethod overridinginheritance
C# class inheritance diagram showing access modifiers controlling member visibility from derived classes
C#

C# Access Modifiers in Inheritance

Understand how C# access modifiers behave in inheritance: which members derived classes can see, how overriding interacts with accessibility, and when to use protected internal or private protected.

C# inheritanceaccess modifiersprotected membersvirtual and override
Illustration of a C# class hierarchy with protected members visible only to derived classes, shown as a shield around the base class.
C#

C# Protected Inheritance: Access in Derived Classes

Understand how the protected access modifier works in C# inheritance, including access rules, derived class usage, and design tradeoffs.

C# inheritanceprotected access modifieraccess modifiersderived classes
Diagram showing a single inheritance chain in C# with multiple interface blocks attached to one class node, illustrating the alternative to multiple inheritance
C#

Multiple Inheritance in C#: What to Use Instead

C# classes support only single inheritance. This article explains why, and how interfaces, default interface methods, composition, and extension methods provide alternatives.

C# inheritanceinterfacescompositiondefault interface methods
Diagram showing a sealed method preventing a derived class from overriding it
C#

C# Sealed Method: Preventing Overrides

Learn how to declare a sealed method in C#, what it prevents, and when to use it to control inheritance behavior.

C#sealedinheritanceoverride