Using the Code Definition Window

The code definition window is a “helper” window that works in close conjunction with the code editor window by displaying definitions for symbols selected within the code editor. It is actually a near clone of the code editor window, with one big exception: It is read-only and does not permit edits to its content.

The code definition window content is refreshed anytime the cursor position is moved within the code editor window. If the cursor or caret is placed in a symbol/type, the code definition window shows you how that symbol is defined.

The code definition window has reacted to the cursor position by showing the source code that actually defines the type of the _state field. You can see from the figure that the code definition window is a fairly featured adaptation of a text editor window: it supports bookmarks, breakpoints, and various navigation aids. Although you cannot edit code using this window, you are not prevented from copying code out of the window.

You can open a code definition window by using the View menu.


Tip

The code definition window also works well with the Class View window. If you single-click a class within the Class View window, the code definition window refreshes to show you the code implementation for that class.


Visual Studio 2015 also has an alternate, and quicker way, of getting to the definition of a particular type, method, or property. It’s called peek definition. To see this in action, put your cursor over a type or member within the editor window, right-click, and then select Peek Definition. A small editing window will open within the parent code editor window. The advantage to this is that you don’t need to switch your attention away from the code at hand, and you can edit the definition code directly (unlike the Code Definition window). See Figure 6.30 for an example of peek definition in action.

Image

FIGURE 6.29 Using Peek Definition.

Image

FIGURE 6.30 Editing an XML document.

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

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