Skip to content

Jonnius00/c_sharp_imtermediate

Repository files navigation

Mosh Hamedani C# Intermediate Exercises

Welcome to the Mosh Hamedani C# Intermediate Exercises repository! This project contains hands-on implementations of key object-oriented programming principles and .NET concepts, helping you solidify your understanding through real-world examples.


🚀 Features

  • Abstraction & Encapsulation: Exercises like StopWatch and StackOverflowPost classes demonstrate clean interfaces and controlled access to internal state.
  • Inheritance & Polymorphism: Custom implementations of Stack (LIFO) and database connections (DbConnection, MsSqlConnection, OracleConnection) showcase class hierarchies and dynamic behavior.
  • Interfaces & Design Principles: A flexible WorkflowEngine and IActivity interfaces illustrate SOLID principles (Single Responsibility, Open/Closed, Interface Segregation).
  • Robust Error Handling: Consistent use of exceptions and validation for safe, predictable execution.
  • Interactive Console Menu: Choose and run exercises interactively via Program.cs.

📂 Project Structure

├── src/
│   ├── StopWatch.cs            # Simulates a stopwatch with Start, Stop, Reset
│   ├── StackOverflowPost.cs    # Models a StackOverflow post with voting
│   ├── Stack_LIFO.cs           # Implements a generic LIFO stack
│   ├── DbConnection.cs         # Abstract DB connection and command execution
│   ├── WorkflowEngine.cs       # Defines workflows and activities via interfaces
│   └── Program.cs              # Console entry point with menu to run exercises
├── App.config                  # Configuration for database examples
└── MoshHamedani_Csharp_imtermediate.sln

🔧 Prerequisites

  • .NET Framework: 4.7.2
  • IDE: Visual Studio 2022 or later (Windows)

🏁 Getting Started

  1. Clone the repository
    git clone https://github.com/your-username/MoshHamedani-CSharp-Intermediate.git
  2. Open the solution file in Visual Studio:
    cd MoshHamedani-C-Sharp-Intermediate
    MoshHamedani_Csharp_imtermediate.sln
  3. Build the solution (ensure targeting .NET Framework 4.7.2).
  4. Run the application (F5). You will see a menu prompting you to select an exercise.

🎯 Usage

Upon running, enter the corresponding number to execute an exercise:

Option Exercise
1 StopWatch demo (abstraction, TimeSpan)
2 StackOverflowPost demo (encapsulation, properties)
3 Custom Stack (LIFO) demo (inheritance, data structures)
4 DbConnection & DbCommand demo (polymorphism, DB IO)
5 WorkflowEngine demo (interfaces, SOLID principles)

🤝 Contributing

Contributions are welcome! Feel free to:

  • Add new exercises or improve existing ones.
  • Enhance exception handling and test coverage.
  • Submit pull requests with clear descriptions and use cases.

📄 License

This project is for educational purposes. Feel free to use and adapt the code for your own learning.


Need any additional details or tweaks? Let me know!

Releases

No releases published

Packages

No packages published

Languages