Use Code Snippets ... productivity rules - Willy-Peter Schaub's Cave of Chamomile Simplicity

Use Code Snippets ... productivity rules

This is nothing new, but I want to mention it both as an easy find reminder for myself and as s hint to others not yet using code snippets. This feature in Visual Studio is great, if only you can remember the shortcuts and the default snippets q;-)

Shortcuts
Lime Green Man Kneeling On One Knee To Look Closer At Something While Inspecting Or Investigating Clipart Illustration

  • snippet name TAB TAB              ... implement snippet
  • CTRL-K, CTRL-X                         ... present snippets
  • CTRL-K, CTRL-S                         ... surround by snippet

Default Snippets (extracted from MSDN "as is")

#if

Creates a #if directive and a #endif directive.

#region

Creates a #region directive and a #endregion directive.

~

Creates a destructor for the containing class.

attribute

Creates a declaration for a class that derives from Attribute.

checked

Creates a checked block.

class

Creates a class declaration.

ctor

Creates a constructor for the containing class.

cw

Creates a call to WriteLine.

do

Creates a dowhile loop.

else

Creates an else block.

enum

Creates an enum declaration.

equals

Creates a method declaration that overrides the Equals method defined in the Object class.

exception

Creates a declaration for a class that derives from an exception (Exception by default).

for

Creates a for loop.

foreach

Creates a foreach loop.

forr

Creates a for loop that decrements the loop variable after each iteration.

if

Creates an if block.

indexer

Creates an indexer declaration.

interface

Creates an interface declaration.

invoke

Creates a block that safely invokes an event.

iterator

Creates an iterator.

iterindex

Creates a "named" iterator and indexer pair by using a nested class.

lock

Creates a lock block.

mbox

Creates a call to MessageBox..::.Show. You may have to add a reference to System.Windows.Forms.dll.

namespace

Creates a namespace declaration.

prop

Creates an auto-implemented property declaration.

propg

Creates a read-only auto-implemented property with a private "set" accessor.

sim

Creates a staticint Main method declaration.

struct

Creates a struct declaration.

svm

Creates a staticvoid Main method declaration.

switch

Creates a switch block.

try

Creates a try-catch block.

tryf

Creates a try-finally block.

unchecked

Creates an unchecked block.

unsafe

Creates an unsafe block.

using

Creates a using directive.

while

Creates a while loop.

 

... snippets are also exception for demo code! Have a look at it today. Get the instructions from How to: Create a Basic Code Snippet.

Published Saturday, November 15, 2008 1:14 PM by willy
Filed under:

Comments

No Comments

Leave a Comment

(required) 
(required) 
(optional)
(required) 

Enter the numbers above: