
Make Pasting into Visual Studio Easier #7
Chapter 2, Master the Editor
|
39
HACK
Paste as Comment
Just as with strings, any text on the clipboard may be pasted as a block of
comments. I’ve found this very helpful in many cases. Having instant blocks
of comments makes development much easier because of the following
reasons:
• Business rule requirements may be pasted directly into the code for eas-
ier translation and to explain what is being done.
• Documentation from MSDN or other sources may be pasted in, avoid-
ing the need to switch between the code and a browser window.
• When upgrading code from another platform, the legacy code can be
pasted as a comment, making it easier to ensure the logic is the same.
To paste text as a comment, you simply need to copy text to your clipboard
and then choose Paste As
➝ Comment. For example, if you copied the fol-
lowing piece of text to your clipboard:
Call the test method to walk through this scenario and test every part.
and then pasted it into your document using Paste As ➝ Comment, you
would see the following comment added:
//Call the test method to walk through this scenario and test every part.
Paste as Region
When pasting as a region, the clipboard text will simply appear between
#region and #endregion tags with a region name of your choice. This feature
is often helpful when organizing code within your application or pasting
regions of code developed by ...