RSS

Visual Studio 2010 Code Snippets !!

15 Jan

code1

Code snippets are small blocks of reusable code that can be inserted in a code file using a context menu command or a combination of hot-keys. They typically contain commonly-used code blocks such as try-finally or if-else blocks, but they can be used to insert entire classes or methods.

List of Visual Studio snippet shortcuts:

  1. #if – Creates an #if directive and an #endif directive.
  2. #region – Creates a #region directive and an #endregion directive.
  3. ~ – Creates a destructor for the containing class.
  4. attribute – Creates a declaration for a class that derives from Attribute.
  5. checked – Creates a checked block.
  6. class – Creates a class declaration.
  7. ctor – Creates a constructor for the containing class.
  8. cw – Creates a call to WriteLine.
  9. do – Creates a do while loop.
  10. else – Creates an else block.
  11. enum – Creates an enum declaration.
  12. equals – Creates a method declaration that overrides the Equals method defined in the Object class.
  13. exception – Creates a declaration for a class that derives from an exception (Exception by default).
  14. for – Creates a for loop.
  15. foreach – Creates a foreach loop.
  16. forr – Creates a for loop that decrements the loop variable after each iteration.
  17. if – Creates an if block.
  18. indexer – Creates an indexer declaration.
  19. interface – Creates an interface declaration.
  20. invoke – Creates a block that safely invokes an event.
  21. iterator – Creates an iterator.
  22. iterindex – Creates a “named” iterator and indexer pair by using a nested class.
  23. lock – Creates a lock block.
  24. mbox – Creates a call to System.Windows.Forms.MessageBox.Show. You may need to add a reference to System.Windows.Forms.dll.
  25. namespace – Creates a namespace declaration.
  26. prop – Creates a property declaration and a backing field.
  27. propg – Creates a property declaration with only a “get” accessor and a backing field.
  28. sim – Creates a static int Main method declaration.
  29. struct – Creates a struct declaration.
  30. svm – Creates a static void Main method declaration.
  31. switch – Creates a switch block.
  32. try – Creates a trycatch block.
  33. tryf – Creates a tryfinally block.
  34. unchecked – Creates an unchecked block.
  35. unsafe – Creates an unsafe block.
  36. using – Creates a using directive.
  37. while – Creates a while loop.
 
Leave a comment

Posted by on January 15, 2013 in Visual Basic .NET, Visual C# . NET

 

Tags: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
%d bloggers like this: