60Microsoft Visual Studio 2010: A Beginner’s Guide
Figure 2-13 A switch snippet template
is required. When the program executes a break statement, it stops executing the switch statement and begins executing the next statement after the last curly brace of the switch statement.
For the VB example, the Select Case statement uses name as the condition and executes code based on which case matches name. The Case Else code block will run if no other cases match.
Switch Statement Snippets
There are two scenarios for switch statement snippets: a minimal switch statement and an expanded switch with enum cases. First, try the minimal switch statement by typing sw and pressing TAB, TAB, resulting in the switch statement in Figure
You would replace the switch_on in Figure
switch (name)
{
default:
break;
}
VB Select statements work similar to the C# switch; type Se and press TAB, TAB; you’ll see the VB template shown in Figure