Class in VS, function code automatically adds copyright annotation information

Take the web project as an example:
One: Annotate classes
1. Under the installation path of visual studio
For example: [disc character]: Program files Microsoft Visual Studio 8 Common7 IDE ItemTemplates web cshare class. zip, change the class.cs to:
/*----------------------------------------------------------------
// Copyright. 
//
// File name:
// File Function Description:
//
// 
// Create logos:
//
// Modify the logo:
// Modified Description:
//
// Modify the logo:
// Modified 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 $safe itemrootname $
/// </summary>
public class $safeitemrootname$  
{  
public $safeitemrootname$()  
    {  
//
// TODO: Add constructor logic here
//
    }  
}
Save the file (decompression, modification)
Others are also, find the corresponding modification can be done. Personally, I prefer the second one. Everywhere you go.
II: VS macroscript add function annotation template
Now the IDE is becoming stronger and stronger, which saves us a lot of lazy people. In order to use future code for your own or others to understand, annotations are essential. When annotations are added to functions, the format is fixed. Writing each function once or copying it from another function is cumbersome and error-prone. This kind of duplicate work makes people have the desire not to write notes, then VS macro can get rid of these "dirty, messy, tired" physical work.
Look, the macro script of VS2010 is VBScript, which is easy to use. I wrote a macro script to generate function annotation template. It's easy to see the code:
Imports System
Imports EnvDTE
Imports EnvDTE80
Imports EnvDTE90
Imports EnvDTE90a
Imports EnvDTE100
Imports System.Diagnostics

Public Module ModuleTop
    Sub AddFunComment()
        Dim DocSel As EnvDTE.TextSelection
        DocSel = DTE.ActiveDocument.Selection
        DocSel.NewLine()
        DocSel.Text = "/*******************************************************************"
        DocSel.NewLine()
        DocSel.Text = "* All rights reserved: "
        DocSel.NewLine()
        DocSel.Text = "* Class name: "
        DocSel.NewLine()
        DocSel.Text = "* Functions: "
        DocSel.NewLine()
        DocSel.Text = "* Parameter: "
        DocSel.NewLine()
        DocSel.Text = "* Return value: "
        DocSel.NewLine()
        DocSel.Text = "* Author: 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 Sub

End Module
Specific creation steps: VS2010 IDE - > Tools - > Macro - > New macro project, select the location to be saved. Then copy the script above and save it.

Specific use: macro-bound shortcuts for you, VS2005 IDE - > tools - > Options - > in the left list select "keyboard" - > in the right "display command contains", select you to create macro - > locate the cursor at "press shortcuts" - > enter the shortcuts you want to name, such as "Alt+C", and save.
The following is a note inside the class in the attached paragraph
Imports System
Imports EnvDTE
Imports EnvDTE80
Imports EnvDTE90
Imports EnvDTE90a
Imports EnvDTE100
Imports System.Diagnostics

Public Module ModuleContent
    Sub AddFunComment()
        Dim DocSel As EnvDTE.TextSelection
        DocSel = DTE.ActiveDocument.Selection
        DocSel.NewLine()
        DocSel.NewLine()
        DocSel.Text = " #Region < construction method and destructive method >“
        DocSel.NewLine()
        DocSel.NewLine()
        DocSel.Text = "#Endregion < construction method and destructive method >“
        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 Sub

End Module
The effect is
# region < tectonic and destructive methods >

        # endregion < construction method and destructive method >


        # region < constant >

        # endregion < constant >


        # region < variable >

        # endregion < variable >


        # region < attribute >

        # endregion < attribute >


        # region < method >

        # endregion < method >


        # region < event >

        # endregion < event >
Keyboard shortcut customization. As long as there is conflict with the existing.

Reproduced in: https://my.oschina.net/cookblack/blog/621402

Keywords: Attribute Python

Added by H4mm3r3r on Sat, 15 Jun 2019 00:48:26 +0300