All fields

“Design Patterns in C#” in Information Technology

24 questions across 2 technologies.

Information Technology

24 questions in 2 technologies

#QuestionTechnologyTopicLevel
1What are design patterns, and how are the Singleton, Adapter, and Strategy patterns typically implemented in C#? C# › Design Patterns in C#C#Design Patterns in C#Advanced
2How do you implement a thread-safe Singleton pattern in modern C# using Lazy<T>? C# › Design Patterns in C#C#Design Patterns in C#Beginner
3How does the Factory Method pattern work in C#, and what problem does it solve? C# › Design Patterns in C#C#Design Patterns in C#Beginner
4How would you implement the Decorator pattern in C# to add behavior to an object without modifying its original class? C# › Design Patterns in C#C#Design Patterns in C#Intermediate
5How would you implement the CQRS (Command Query Responsibility Segregation) pattern's basic structure in a C# application using MediatR-style handlers? C# › Design Patterns in C#C#Design Patterns in C#Advanced
6How would you implement the Chain of Responsibility pattern in C# to process a request through a series of independent handlers? C# › Design Patterns in C#C#Design Patterns in C#Advanced
7How would you implement the Strategy pattern in C# using either interfaces or delegates? C# › Design Patterns in C#C#Design Patterns in C#Intermediate
8How would you implement the Observer pattern in C# using events, versus using the IObservable<T>/IObserver<T> interfaces from System? C# › Design Patterns in C#C#Design Patterns in C#Advanced
9How does the Repository pattern abstract data access, and what interface typically defines its contract? C# › Design Patterns in C#C#Design Patterns in C#Intermediate
10How would you implement the Unit of Work pattern alongside the Repository pattern to coordinate multiple repository changes within a single transaction? C# › Design Patterns in C#C#Design Patterns in C#Advanced
11How would you implement the Builder pattern using method chaining (a fluent API) to construct a complex object step by step? C# › Design Patterns in C#C#Design Patterns in C#Advanced
12How would you implement the 'Liskov Substitution Principle' correctly when designing an abstract class hierarchy, and what's a classic violation example? C# › Interfaces & Abstract ClassesC#Interfaces & Abstract ClassesAdvanced
13What is the Inversion of Control (IoC) principle, and how does dependency injection relate to it as one specific technique? C# › Dependency Injection & IoC PrinciplesC#Dependency Injection & IoC PrinciplesIntermediate
14How would you implement the Factory pattern using dependency injection to resolve a specific implementation at runtime based on a parameter, when the standard container can't decide statically? C# › Dependency Injection & IoC PrinciplesC#Dependency Injection & IoC PrinciplesAdvanced
15How would you write a custom IServiceProviderFactory or use a third-party container (like Autofac) to enable advanced DI features not supported by the built-in ASP.NET Core container, like property injection or convention-based registration? C# › Dependency Injection & IoC PrinciplesC#Dependency Injection & IoC PrinciplesAdvanced
16How does interface segregation (the 'I' in SOLID) guide splitting a large, monolithic interface into several smaller, more focused ones? C# › Interfaces & Abstract ClassesC#Interfaces & Abstract ClassesAdvanced
17How would you optimize a LINQ-to-Entities query to avoid the classic 'N+1 query' performance problem when accessing related navigation properties? C# › LINQC#LINQAdvanced
18What is a delegate in C#, and how does it enable passing methods as values? C# › Delegates, Events & LambdasC#Delegates, Events & LambdasBeginner
19What are extension methods in C#, and how do they let you add functionality to a type you can't modify? C# › Extension MethodsC#Extension MethodsIntermediate
20What is dependency injection, and why does it make a codebase easier to test and maintain? .NET › Dependency Injection.NETDependency InjectionIntermediate
21What is reflection, and what basic information can you retrieve from a Type object at runtime? C# › Attributes & ReflectionC#Attributes & ReflectionBeginner
22How do you dynamically create an instance of a type and invoke a method on it using reflection, when the type isn't known at compile time? C# › Attributes & ReflectionC#Attributes & ReflectionIntermediate
23How do you use reflection to read a custom attribute's values off a property at runtime? C# › Attributes & ReflectionC#Attributes & ReflectionIntermediate
24How would you use System.Reflection.Emit or source generators as faster, more modern alternatives to runtime reflection for code generation scenarios? C# › Attributes & ReflectionC#Attributes & ReflectionAdvanced