Generate Method Stub

You can get Visual Studio to automatically generate a method stub for you. This is not strictly a refactoring operation but can provide some similar increases in productivity. The scenario where this is applicable is as follows. Suppose you are writing code that calls a method from one of your objects. However, that method does not yet exist. You can still write code to make the call to the nonexistent method. Visual Studio then recognizes that this method does not exist and provides you an option from the light bulb menu (see Figure 9.19) to create the method.

Image

FIGURE 9.19 Generate a method stub for a nonexistent method.

Clicking the Quick Actions menu item results in Visual Studio generating the method based on the stubbed out call. The method looks like the one previewed in the foldout menu shown in Figure 9.19.

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

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