
Chapter 2: Learning Just Enough C# or VB.NET: Basic Syntax | 47 |
The Options window in Figure
Saving Time with Snippets
Snippets are important to learn because they will save you time. A snippet is a set of keystrokes that form a template for a piece of code. The code for a snippet is typically something that is common in normal programming. You’ll see many common statements and blocks of code in this chapter, many of which have associated snippets. This section shows you the mechanics of using snippets, and you’ll see more examples throughout the rest of this chapter.
To use a snippet, begin typing the snippet prefix until the snippet acronym appears in the Intellisense completion list, press the TAB key twice, and fill in the snippet form while tabbing through each field. Press ENTER when you’re done.
Since you’ve already learned about namespaces, I’ll show you the namespace snippet. To start, open any code file and click to start typing in a part of the file outside of all code blocks, such as directly below any using statements but above any existing namespace statements. Type the letter n and watch the completion list go straight to the namespace element. Type an a and you’ll see the namespace alone in the completion list, as shown in Figure
NOTE
The