50Microsoft Visual Studio 2010: A Beginner’s Guide

You know that there is a dot operator between Console and WriteLine, so go ahead and type the period character, which causes VS to display “Console.” in the editor and show you a new completion list that contains members of the Console class that you can now choose from.

NOTE

So, I’ll admit that I spent a couple paragraphs trying to explain to you how to save a single keystroke, but that’s not the only thing you should get out of the explanation. The real value is in knowing that there are a lot of these detailed options available to increase your productivity. Every time you take advantage of a new VS option, you raise the notch of productivity just a little higher.

5.Now type write and notice that both Write and WriteLine appear in the completion list. Now type the letter l and notice that WriteLine is the only option left in the completion list.

NOTE

If you’ve typed WriteLine a few times, you’ll notice that the completion list goes straight to WriteLine after a few characters, rather than just Write. This is because Intellisense remembers your most frequently used identifiers and will select them from the list first. If you continue to type, Intellisense will then highlight those identifiers with exact matches. Notice the checked option in Figure 2-10; Intellisense preselects most recently used members, showing that this behavior is turned on by default.

6.Save another keystroke and press the ( key to let VS finish the WriteLine method name.

7.At this point, you can finish typing the statement, resulting in a Main method that looks like this:

C#:

static void Main(string[] args)

{

Console.WriteLine("Hello from Visual Studio 2010!");

}

VB:

Sub Main()

Console.WriteLine("Hello from Visual Studio 2010!")

End Sub

If you’re a C# developer and want to change Intellisense options, open Tools Options and select Text Editor C# Intellisense, and you’ll see the Intellisense options in Figure 2-10. This option isn’t available for VB.

Page 73
Image 73
Microsoft 9GD00001 manual Microsoft Visual Studio 2010 a Beginner’s Guide