← All interview questions

Skill Zuno · skillzunos.com · Fullstack

C# Design Patterns interview questions

Prepare for C# Design Patterns interviews on Skill Zuno. This practice book covers C# Design Patterns interview questions across New, Easy, Medium, Hard, and Diff levels so you can work through real interview-style problems on skillzunos.com.

Open C# Design Patterns on Skill Zuno

Also see the C# Design Patterns tutorial.

Design patterns in C# build on interfaces, generics, delegates, events and the dependency injection built into .NET. Some classic patterns are part of the language itself: observer through events, iterator through IEnumerable and yield, and decorator through middleware. Interviews cover Gang of Four patterns, SOLID, DI and patterns used in ASP.NET Core.

Sample C# Design Patterns interview questions

How does C# implement the observer pattern natively?

With events. A publisher declares event EventHandler<T> Changed, subscribers attach handlers with +=, and the publisher raises it. Subscribers must unsubscribe with -= or they can be kept alive and leak memory.

Is the repository pattern still useful with Entity Framework Core?

DbContext already acts as a unit of work and DbSet as a repository, so a generic repository over EF often adds little. A domain-specific repository is still useful to hide queries and make business logic testable.

How does yield return implement the iterator pattern?

The compiler turns a method using yield return into a state machine that implements IEnumerable<T>. Items are produced lazily, one per MoveNext() call.

How do you register a decorator in .NET's DI container?

The built-in container has no decorate helper, so register the inner service and add a factory that wraps it, or use a library such as Scrutor and call services.Decorate<IService, LoggingService>().

What is the mediator pattern and how is it used in .NET?

A mediator sends requests to handlers so senders and receivers do not reference each other. Libraries such as MediatR use it to implement CQRS, with one handler per command or query.

What you can practice

  • C# Design Patterns interview questions for beginners and experienced developers
  • Level-based practice: New, Easy, Medium, Hard, and Diff
  • Fullstack topics alongside C# Design Patterns on skillzunos.com

More Fullstack interview questions

All interview questions