This project demonstrates best coding practices in C# with simple examples. The goal is to write clean, readable, maintainable, and professional code.
- Parent-Child (Inheritance)
- Encapsulation (Properties vs Fields)
- Abstract Class (Abstract + Concrete methods)
- Avoid long methods (Method Refactoring)
- Avoid too many method parameters
- Avoid nested ternary operators
- Avoid large switch statements
- Use Dictionary instead of large switch
- Use methods inside switch instead of long logic
- Use PascalCase for Classes, Methods, Properties
- Use meaningful variable names
- Use
nameof()instead of hardcoded strings
- Never use public fields
- Use auto-implemented properties
- Avoid write-only properties
- Use readonly where applicable
- Use if-else vs switch appropriately
- Maintain consistency in curly braces
- Avoid nested conditions
- Never leave empty catch blocks
- Proper exception handling and logging
- Use Async suffix for async methods
- Avoid commented-out code
- Track TODO and FIXME properly
- Avoid multiple variable declarations in one line
- Assign default values properly
- Keep lines short and readable
- Avoid using
new Guid()→ useGuid.NewGuid() - Use enum properly with integer values
- Avoid tight coupling between classes
- Improve coding standards
- Write professional-level code
- Prepare for interviews
- Build real-world coding habits
"Clean code is not about writing less code, it's about writing better code."
Sushil Thakur
- Clone the repository
- Open in Visual Studio
- Run the console application
- Add SOLID principles examples
- Add real-world project structure
- Add unit testing
Feel free to fork and improve this project 🚀