Visual Studio template code comments to share tips

In the daily development process, it is inevitable that such a demand: that you are building a class file or each interface file require labeling purposes under the author's name and class. If the file is created every time we need to write it again when information is annoying God. Fortunately, Visual Studio provides us with a template comment function to automatically help us generate similar comments in the code. Taking advantage of a break at noon time today, let us work together to operate under it.

Author: according to Le Wish
Original link: https://www.cnblogs.com/yilezhu/p/11132090.html

  1. First, navigate to the installation directory of your VS: C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\IDE\ItemTemplates\CSharp\Code\2052here you may want to do a version vs the appropriate adjustment path according to the specific how to adjust, smart as I think you should be able to understand.

    1562219147567

  2. After positioning the upper path, as seen in the file structure, the file structure about a substantially presented here, where we only class and an interface template code annotation WebClass provided, the other may be selected to set their own:

    1562219294264

  3. We open the Classfolder, see the following two files, select .csthe end of the file and open. As follows:

    1562219404140

  4. Open, will see the code as shown below:

    1562219528824

This time we add our comments at the top of the template file, as follows:

1562219622876

Specific text code is as follows, of course, you can according to their preferences, set free the comment template, last, I will give a few more template:

/*
*┌────────────────────────────────────────────────┐
*│ 描    述:$safeitemrootname$                                                    
*│ 作    者:lzhu                                              
*│ 版    本:1.0                                              
*│ 创建时间:$time$                        
*└────────────────────────────────────────────────┘
*/
using System;
using System.Collections.Generic;
$if$ ($targetframeworkversion$ >= 3.5)using System.Linq;
$endif$using System.Text;
$if$ ($targetframeworkversion$ >= 4.5)using System.Threading.Tasks;
$endif$
namespace $rootnamespace$
{
    public class $safeitemrootname$
    {
    }
}
  1. In the same way, set the interface template code comments, there is not demonstrated. Just to note is that after the changes need to be saved as an administrator.

  2. Next, we restart at vs, and then try to create a class file under the bar as shown below:

    1562219920638

  3. So far, we have set up is complete. Try it quickly.

Finally, the last, give you a few more bold comment template:

////////////////////////////////////////////////////////////////////
//                          _ooOoo_                               //
//                         o8888888o                              //
//                         88" . "88                              //
//                         (| ^_^ |)                              //
//                         O\  =  /O                              //
//                      ____/`---'\____                           //
//                    .'  \\|     |//  `.                         //
//                   /  \\|||  :  |||//  \                        //
//                  /  _||||| -:- |||||-  \                       //
//                  |   | \\\  -  /// |   |                       //
//                  | \_|  ''\---/''  |   |                       //
//                  \  .-\__  `-`  ___/-. /                       //
//                ___`. .'  /--.--\  `. . ___                     //
//              ."" '<  `.___\_<|>_/___.'  >'"".                  //
//            | | :  `- \`.;`\ _ /`;.`/ - ` : | |                 //
//            \  \ `-.   \_ __\ /__ _/   .-` /  /                 //
//      ========`-.____`-.___\_____/___.-`____.-'========         //
//                           `=---='                              //
//      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^        //
//                   佛祖保佑       永不宕机     永无BUG          //
////////////////////////////////////////////////////////////////////

Thanks everyone for reading.

Guess you like

Origin www.cnblogs.com/yilezhu/p/11132090.html