Source Window

   

As the centerpiece of Visual Studio .NET, the source code window is where you do most of the work. Even though source code is in an ASCII text-only format, programming languages contain syntax rules that allow Visual Studio .NET to take advantage of them to organize and present the source code in various ways.

Outlining

If you've ever used the previous version of Visual Basic, you'll recall that functions were separated from each other by horizontal lines. Although this might have been annoying to some, it at least organized the code into discernable blocks. These horizontal lines are gone now, but in their place is a very nice addition to source code layout: outlining. Visual Studio .NET determines where certain blocks of code exist within in a source file and separates them into collapsible segments. This occurs regardless of the programming language being used. At the very top of the block of code, you can see a box that is used to collapse or expand a block of code simply by clicking it. If a block of code is collapsed, you will see the first line of that source code block followed by a box containing an ellipsis, indicating that more code will be revealed once that block is expanded.

Specifically within Visual C++ .NET, code blocks occur frequently throughout a source code file. You can collapse entire class definitions, preprocessor directives, structures, functions, and even conditional statement blocks. Figure B.1 shows an open source code file with two collapsed classes and an expanded function.

Figure B.1. Source code outlining helps with code readability.

graphics/bfig01.jpg

Task List Shortcuts

One thing I have noticed that many developers do, including myself, is to add comments with TODO statements. In fact, by using #pragma statements, you can constantly be reminded that you have something "to do." Visual Studio .NET has expanded on this practice by creating the Task List window. The Task List window serves several different purposes. The one feature of the Task List you will no doubt become familiar with involves the build warnings and error tasks that show up after each build. After each build, all the warnings and errors that occurred are transferred to the Task List window, where you can check off the warnings and errors as you fix them.

Instead of using #pragma statements to display TODO items, you can add a comment followed by the word TODO and the entire comment line will be added to the Task List. If you need to jump to that comment, you can double-click the Task List item, and the file will be opened at that location. Figure B.2 shows the Task List with a TODO Task List item.

Figure B.2. Creating TODO comments automatically adds Task List items.

graphics/bfig02.jpg


   
Top


Sams Teach Yourself Visual C++. NET in 24 Hours
Sams Teach Yourself Visual C++.NET in 24 Hours
ISBN: 0672323230
EAN: 2147483647
Year: 2002
Pages: 237

Similar book on Amazon

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