Extract Interface

When classes contain the same subset of members, defining a common contract that each class shares can be useful. You do this, of course, via an interface. Some basic advantages to defining interfaces are that your code becomes more readable, is easier to maintain, and operates the same for like members. However, developers often don’t realize the commonality between their classes until after those classes are coded. This sometimes makes creating interfaces painful.

The Visual Studio code editor provides the Extract Interface refactoring operation to make this process easier. It enables you to take an existing class or struct and automatically generate a matching interface that the existing class then implements.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset