This project demonstrates the five SOLID principles of object-oriented design in C# through clear, side-by-side examples. Each principle is organized into its own folder, containing both Incorrect (violating the principle) and Correct (properly applying the principle) implementations.
SOLID is an acronym for five design principles that make software designs more understandable, flexible, and maintainable:
- S - Single Responsibility Principle
- O - Open/Closed Principle
- L - Liskov Substitution Principle
- I - Interface Segregation Principle
- D - Dependency Inversion Principle
SolidPrinciplesDemo/
├── 1.SingleResponsibility/
│ ├── Correct.cs
│ └── Incorrect.cs
├── 2.OpenClosed/
│ ├── Correct.cs
│ └── Incorrect.cs
├── 3.LiskovSubstitution/
│ ├── Correct.cs
│ └── Incorrect.cs
├── 4.InterfaceSegregation/
│ ├── Correct.cs
│ └── Incorrect.cs
└── 5.DependencyInversion/
├── Correct.cs
└── Incorrect.cs
Contributions are welcome! Please feel free to submit a Pull Request.
This project is licensed under the MIT License - see the LICENSE file for details.
Each section provides simple, easy-to-understand C# code snippets to help you quickly grasp both the mistakes and best practices when applying SOLID principles.