What are the SOLID principles?
SOLID is a group of five object-oriented design principles intended to improve maintainability, flexibility, and testability.
C# interview questions covering solid, di, testing & practical c#.
Open a question for the full answer, code and interview guidance.
SOLID is a group of five object-oriented design principles intended to improve maintainability, flexibility, and testability.
The Single Responsibility Principle states that a class or module should have one focused responsibility or one primary reason to change.
Dependency Injection (DI) is a design technique where a class receives its dependencies from outside rather than creating them internally.
ASP.NET Core's DI container supports several service lifetimes.
Loose coupling means components depend as little as practical on concrete implementation details.
Unit testing verifies a small unit of behavior, such as a method or service, in isolation from unrelated infrastructure.
Mocking replaces a dependency with a controllable test double so that the unit under test can be tested without calling the real external component.
Unit testing focuses on a small piece of logic and normally isolates external dependencies. It is fast and useful for verifying business rules and edge cases.
Performance optimization should be driven by measurement rather than assumptions. Profiling, tracing, metrics, database execution plans, and benchmarks help identify actual bottlenecks.
Clean production C# code should have clear responsibilities, meaningful names, appropriate abstractions, predictable error handling, and strong testability.