Other Editing Features in Visual Studio 2005


Editing in Visual Studio 2005 is much easier thanks to a number of new and updated features that have been added to the IDE since Visual Studio 2003. Among these are Code Snippets, refactoring, the Code Definition Window, and the Call Browser.

Code Snippets

Code Snippets is a feature added for Visual Basic, Visual C#, Microsoft Visual J#®, and XML that allows a programmer to insert commonly used snippets of code into a project. You can insert a snippet by right-clicking in the Code Editor in a supported project type and clicking Insert Snippet. Figure 3-7 shows you how this looks in Visual Basic. You can insert a small amount of code or a significant block, depending on the functionality that you're adding. This can be a real timesaver as you work on your projects.

image from book
Figure 3-7: Inserting a code snippet into the Code Editor

Snippets are managed through the Code Snippets Manager. You can create your own snippets in XML. The Code Snippets Manager, available from the Tools menu, allows you to import XML files with your own code snippets.

Refactoring

Refactoring allows you to improve your code after you've written it by providing tools for automatically updating the structure of the code without making any changes to the functionality. This means that you can write a bit of code and then later use the tools in Visual Studio 2005 to change that code to improve the structure of your functions or to better encapsulate them for re-use. For example, by extracting an algorithm from a button_ click event, you make it much easier to access the product of that algorithm from a different part of your application.

Code Definition Window

The Code Definition Window is a new tool in Visual Studio 2005 for Visual C++, Visual C#, and Visual J#. This window shows the definition of a selected symbol in the IDE. You can use the Code Definition Window to view the code definition file for the particular symbol if it's available. This window is dynamic, and it changes when you select various symbols in a source file. The Code Definition Window is available from the View menu or by using the View.CodeDefinitionWindow command in the Command Window.

Call Browser

The Call Browser is an interesting tool in that it lets you see calls to specific functions by displaying a Callers Graph that contains links to those places in the project from which the function is being called. This can be very useful when you want to see exactly who is calling your function. When a function is analyzed in the IDE, the title of the Call Browser window changes to Callers Graph and presents you with a tree that you can use to navigate your code.




Working with Microsoft Visual Studio 2005
Working with Microsoft Visual Studio 2005
ISBN: 0735623155
EAN: 2147483647
Year: 2006
Pages: 100

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net