C# Fundamentals - Third Edition

Snippet and shortcut keys can help save time while coding in Visual Studio. With snippet keys, enter only a few letters or a keyword and then press tab twice to insert a code fragment.

Example: cw (tab) (tab)

// cw (tab)(tab) : Type cw and then press the tab key twice, the line below will display
Console.WriteLine();

 

Snippet & Shortcut Keys

Result

cw (tab) (tab)

Console.WriteLine();

while (tab) (tab)

 

 

while (true)

{

}

for (tab) (tab)

 

 

 for (int i = 0; i < length; i++)

{

}

foreach (tab) (tab)

 

 

foreach (var item in collection)

{

}

do (tab) (tab)

 

 

do

{

} while (true);

prop (tab) (tab)

public int MyProperty { get; set; }

(F5)

Will start debugging

(ctrl) + (F5)

Will start without debugging