When talking about SOLID principles, we will start off with the single responsibility principle (SRP). Here, we are actually saying that a class has a specific task that it needs to fulfill and it should not do anything else.
Single responsibility principle
Getting ready
You will create a new class and write code to log an error to the database when an exception is thrown on adding more troops to the star ship, causing it to be over capacity. For this recipe, ensure that you have added using System.Data; and using System.Data.SqlClient; namespaces to your application.
How to do it...
- Create a new class called StarShip...