Interfaces, abstract classes, virtual and override, sealed, static, partial and nested classes, records, structs, access modifiers, properties, indexers and operator overloading.
-
How do interfaces work in modern C#? Explain what an interface can contain today (default interface methods, static abstract members), explicit implementation, how interface calls are dispatched, and the boxing trap with structs.
Interfaces as contracts in C# 14: members allowed, default implementations, static abstract members for generic math, explicit implementation, dispatch cost and struct boxing.
Mid-Level
Theory
C# OOP Features
Β· π 3 follow-ups Β· π 1 real-world
-
What is an abstract class in C#, and when would you use one? Explain abstract members, constructors and state in an abstract class, the template method pattern, and how abstract classes evolve compared with interfaces.
Abstract classes in C#: abstract versus virtual members, constructors and shared state, the template method pattern, BCL examples and versioning trade-offs.
Mid-Level
Theory
C# OOP Features
Β· π 3 follow-ups Β· π 1 real-world
-
What are virtual methods in C#? Explain why members are non-virtual by default, how a virtual call is dispatched at run time, what it costs, when the JIT can devirtualise it, and what can and cannot be virtual.
Virtual members in C#: opt-in virtuality, method tables and slots, callvirt, performance cost, devirtualisation with sealed and PGO, and the rules on what can be virtual.
Mid-Level
Theory
C# OOP Features
Β· π 3 follow-ups Β· π 1 real-world
-
How does method overriding work in C#? Explain override versus new (hiding), sealed override, calling base, covariant return types, the rules an override must follow, and the bugs that hiding and default parameter values cause.
Overriding in C#: override versus new, CS0108/CS0114 warnings, sealed override, base calls, C# 9 covariant returns, signature rules, and the default-parameter trap.
Mid-Level
Theory
C# OOP Features
Β· π 2 follow-ups Β· π 1 real-world
-
What does sealed mean in C#, and should application classes be sealed by default? Explain sealed classes and sealed overrides, the performance benefits, the effect on testing and mocking, and the versioning rules.
Sealed classes and members in C#: what they prevent, why sealing helps the JIT and type checks, CA1852, testing trade-offs, and why unsealing is safe but sealing is breaking.
Mid-Level
Theory
C# OOP Features
Β· π 2 follow-ups Β· π 1 real-world
-
What is a static class in C#? Explain what it can contain, how it differs from a singleton, where extension methods and C# 14 extension members live, static state and thread-safety, and why heavy use of static classes hurts testability.
Static classes in C#: rules, static constructors, extension methods and C# 14 extension blocks, static versus singleton, shared state risks and testability.
Junior
Theory
C# OOP Features
Β· π 2 follow-ups Β· π 1 real-world
-
What are partial classes and partial members in C#? Explain how the parts are combined, why source generators depend on them, partial methods (classic and extended), partial properties (C# 13) and partial constructors and events (C# 14).
Partial types and members in C#: compile-time merging rules, generated code, partial methods, partial properties and C# 14 partial constructors and events.
Mid-Level
Theory
C# OOP Features
Β· π 2 follow-ups Β· π 1 real-world
-
What are nested types in C#? Explain how a nested class differs from a Java inner class, what it can access in the outer type, default accessibility, and when nested types are a good or a bad design choice.
Nested classes in C#: access to outer private members, no implicit outer instance, private default accessibility, generics, BCL examples and design guidelines.
Mid-Level
Theory
C# OOP Features
Β· π 2 follow-ups Β· π 1 real-world
-
What are records in C#? Explain record classes and record structs, what the compiler generates (value equality, ToString, Deconstruct, with-expressions), how equality works with inheritance, and where records are a poor fit.
C# records: positional syntax, generated members, value equality and EqualityContract, non-destructive mutation with `with`, record structs, and pitfalls such as collections and EF Core entities.
Mid-Level
Theory
C# OOP Features
Β· π 3 follow-ups Β· π 1 real-world
-
How do structs work in C#? Explain value semantics and copying, constructors and default values, readonly structs and readonly members, ref structs and Span, record structs, boxing, and the bugs that mutable structs cause.
C# structs in depth: copying, default(T), parameterless constructors, readonly structs and defensive copies, ref structs, C# 13 interface support, boxing and mutable-struct bugs.
Senior
Theory
C# OOP Features
Β· π 3 follow-ups Β· π 1 real-world
-
What access modifiers does C# have, and how do you use them to design a clean API? Explain public, private, protected, internal, protected internal, private protected and file, the default accessibility of each declaration, and InternalsVisibleTo.
C# access modifiers including private protected and file, defaults per declaration, accessor-level modifiers, InternalsVisibleTo, and using accessibility to keep API surface small.
Junior
Theory
C# OOP Features
Β· π 2 follow-ups Β· π 1 real-world
-
How do properties work in C#? Explain auto-properties and backing fields, get/set/init accessors, required members (C# 11), the C# 14 field keyword, computed properties, and when to use a property, a field or a method.
C# properties: how they compile, init and required, the C# 14 field keyword, validation, computed properties, binary compatibility and property-versus-method guidelines.
Mid-Level
Theory
C# OOP Features
Β· π 2 follow-ups Β· π 1 real-world
-
What are indexers in C#? Explain how to declare and overload them, how they compile, how they work with Index and Range (^1 and ..), ref-returning indexers, and when an indexer is or is not a good API.
C# indexers: syntax, overloading, the Item property in metadata, implicit Index/Range support, ref returns as in `Span<T>`, dictionary indexer semantics and design guidelines.
Mid-Level
Theory
C# OOP Features
Β· π 3 follow-ups Β· π 1 real-world
-
How does operator overloading work in C#? Explain the rules for declaring operators, which operators come in pairs, equality operators and Equals, conversion operators, checked operators, generic math interfaces, and C# 14 user-defined compound assignment operators.
C# operator overloading: syntax and rules, required pairs, == with Equals/GetHashCode, implicit and explicit conversions, checked operators, generic math, C# 14 compound assignment and design guidelines.
Mid-Level
Theory
C# OOP Features
Β· π 3 follow-ups Β· π 1 real-world