VS is a class. The function code automatically adds the copyright annotation information.

Source: Internet
Author: User
Take a web project as an example:

I. Add comments to the class

1. Under the installation path of Visual Studio
For example: [drive letter]: \ Program Files \ Microsoft Visual Studio 8 \ common7 \ ide \ itemtemplates \ WEB \ cshare \ 2052 \ class.zip, change class. CS:

/* ---------------------------------------------------------------- // All Rights Reserved. //// File name: // file Function Description: ///// create an ID: // modify the description: /// modify the ID: // modify Description: // ------------------------------------------------------------------ */using system; using system. data; using system. configuration; using system. web; using system. web. security; using system. web. ui; using system. web. UI. webcontrols; using system. web. UI. webcontrols. webparts; using system. web. UI. htmlcontrols; // <summary> /// Summary of $ safeitemrootname $ /// </Summary> public class $ safeitemrootname $ {public $ safeitemrootname $ () {// todo: add the constructor logic here //}}
Save the file (decompress the file and modify it)

For others, find the corresponding modification. I personally prefer the second type. It will become everywhere you go.

Ii. vs macro script: Add a function annotation Template
The more powerful IDE is, the more I am waiting. To use future Code You can understand it yourself or others. It is essential to comment on such things. When you add comments to a function, the format is fixed. Writing each function once or copying it from another function is troublesome and error-prone. This type of repetitive work makes people upset and have the desire to write comments. At this time, the macro of VS can eliminate these "dirty, messy, and tired" physical work.
After reading this, the macro script of vs2010 is VBScript, which is easy to use. I wrote a macro script to generate a function annotation template, which is relatively easy. Check the Code:

Imports systemimports envdteimports envdte80imports envdte90imports envdte90aimports envdte100imports system. diagnosticspublic module moduletop sub addfuncomment () dim docsel as envdte. textselection docsel = DTE. activedocument. selection docsel. newline () docsel. TEXT = "/************************************ * ***************************** "docsel. newline () docsel. TEXT = "* copyright:" docsel. newline () docsel. TEXT = "* class name:" docsel. newline () docsel. TEXT = "* function:" docsel. newline () docsel. TEXT = "* parameter:" docsel. newline () docsel. TEXT = "* return value:" docsel. newline () docsel. TEXT = "* OPERATOR: XXXXX" docsel. newline () docsel. TEXT = "* E-mail: XXXXXX@gmail.com" docsel. newline () docsel. TEXT = "* creation date:" + system. datetime. now. tostring () docsel. newline () docsel. TEXT = "************************************* * ****************************/"End subend Module
Specific creation steps: vs2010 ide-> tool-> macro-> new macro project, select the location to save. Copy the above script and save it.
Specific Use: bind the shortcut key for your macro, vs2005 ide-> Tools-> options-> select "keyboard" on the left-side Navigation Pane-> display command inclusion on the right side, choose create macro> position the cursor to press the shortcut key> enter the shortcut key you want to name, such as ALT + C, and save it. The following is a description of the class.
Imports systemimports envdteimports envdte80imports envdte90imports envdte90aimports envdte100imports system. diagnosticspublic module modulecontent sub addfuncomment () dim docsel as envdte. textselection docsel = DTE. activedocument. selection docsel. newline () docsel. newline () docsel. TEXT = "# region <constructor and destructor>" docsel. newline () docsel. newline () docsel. TEXT = "# endregion <constructor and destructor>" docsel. newline () docsel. newline () docsel. newline () docsel. TEXT = "# region <constant>" docsel. newline () docsel. newline () docsel. TEXT = "# endregion <constant>" docsel. newline () docsel. newline () docsel. newline () docsel. TEXT = "# region <variable>" docsel. newline () docsel. newline () docsel. TEXT = "# endregion <variable>" docsel. newline () docsel. newline () docsel. newline () docsel. TEXT = "# region <attribute>" docsel. newline () docsel. newline () docsel. TEXT = "# endregion <attribute>" docsel. newline () docsel. newline () docsel. newline () docsel. TEXT = "# region <method>" docsel. newline () docsel. newline () docsel. TEXT = "# endregion <method>" docsel. newline () docsel. newline () docsel. newline () docsel. TEXT = "# region <event>" docsel. newline () docsel. newline () docsel. TEXT = "# endregion <event>" End subend Module
The effect is
 
# Region <constructor and constructor> # endregion <constructor and constructor> # region <constant> # endregion <constant> # region <variable> # endregion <variable> # region <attribute> # endregion <attribute> # region <method> # endregion <method> # region <event> # endregion <event>

Shortcut Key customization. As long as there is a conflict with the existing one.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.