Chapter 2: Visual Studio 2008 and C# Express 2008

Quiz Solutions

Solution to Question 2-1. A project results in the production of an executable or a library. Most solutions consist of a single project, but many consist of two or more projects.

Solution to Question 2-2. To move windows in the IDE, click and drag on the title bar; use the indicators for placement.

Solution to Question 2-3. The pushpin button toggles between locking the window in place and hiding it as a tab.

Solution to Question 2-4. F5 runs the program with debugging; Ctrl-F5 runs without debugging. For console applications that do not require any input, Ctrl-F5 is more useful, so you can see the output.

Solution to Question 2-5. The Clipboard Ring allows you to store more than one item on the clipboard.

Solution to Question 2-6. Press Ctrl-Shift-V to cycle through all the selections in the Clipboard Ring.

Solution to Question 2-7. Find Symbol allows you to search for symbols (namespaces, classes, and interfaces) and their members (properties, methods, events, and variables).

Solution to Question 2-8. A bookmark is a tool for returning to a specific place in your code.

Solution to Question 2-9. IntelliSense is an editing tool that supplies suggestions for completing keywords, based on what you’ve typed. It’s a useful tool for saving keystrokes.

Solution to Question 2-10. A code snippet is a complete outline of a commonly used programming structure with replaceable items to speed development.

Exercise Solutions

Solution to Exercise 2-1. Insert a bookmark before the Console.Writeline( ) statement in Hello World. Navigate away from it and then use the Bookmarks menu item to return to it.

Placing a bookmark in code is simple. Simply click on the line containing the WriteLine( ) statement, and then select Edit → Bookmarks → Toggle Bookmark to set the bookmark. You’ll see a light blue square in the left margin, next to the line. Your Visual Studio window should look something like Figure A-1. Navigate away from that line by clicking anywhere else in the program. Now select Edit → Bookmarks → Next Bookmark (or Previous Bookmark; either will work, because there’s only one bookmark in the file), and your cursor will be returned to the line with the WriteLine( ). That’s not terribly useful in a program as short as this one, but if your program is 50 pages long, you’ll be glad for bookmarks.

You may want to select Edit → Bookmarks → Clear Bookmarks when you’re done, to remove the bookmark.

Exercise 2-1.

Figure A-1. Exercise 2-1.

Solution to Exercise 2-2. Undock the Solution Explorer window from the right side of the IDE and move it to the left. Leave it there if you like or move it back.

This task is relatively easy. Simply click on the title bar of the Solution Explorer and drag it away from the right side to undock it, drag it to the arrow pointing left, and release it. Your Visual Studio window should look something like Figure A-2.

Simply reverse the process to move the window back to the right, unless you prefer the Solution Explorer on the left, of course.

Exercise 2-2.

Figure A-2. Exercise 2-2.

Solution to Exercise 2-3. Insert a code snippet for a for loop from the Edit → IntelliSense menu into your Hello World program. (It won’t do anything for now; you’ll learn about for loops in Chapter 5.)

First, click after the semicolon at the end of the WriteLine( ) statement and press Enter once to clear some space. Now select Edit → IntelliSense → Insert Snippet. You’ll see a small drop-down asking you to choose between NetFX30 and Visual C#. Select Visual C# and the drop-down will change to a list of possible snippets. Click for, and the for loop will be inserted for you. Your Visual Studio window should look something like Figure A-3.

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

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