Interface extraction

Do you know how easy it is to extract an interface out of a class? It's very easy and effective with Visual Studio. Let's see the following steps:

  1. Hover on the concrete class; you will see a bulb at the left side.
  2. Click on that to open a drop-down menu. Refer to the following screenshot:
                     
  1. Select the Extract Interface.
  2. A modal pops up which also lists the public members of the class. See the following screenshot:
                      
  1. Hit OK. It will create the interface for you.

There is another ...

Get Dependency Injection in .NET Core 2.0 now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.