当前位置:网站首页>Vs custom template - take the custom class template as an example
Vs custom template - take the custom class template as an example
2022-07-07 22:17:00 【freelooppowter】
Preface
In the actual work process, some companies will require developers to abide by some development specifications in the development process , The development specification mainly includes the annotation specification of the document , project 、 file 、 Variable naming conventions ( For example, hump specifications ) wait . For example, there is a new file comment in our code specification , The notes include the company's copyright statement 、 File name 、 File function description 、 Creation time 、 Founder, etc . There are many comments , Copying and pasting each time is troublesome and time-consuming . So consider whether you can solidify this part , Only a small part of the differentiated content is modified each time . Naturally, I thought of the concept of template , Sure enough, Microsoft is designing VS The compiler takes this problem into account , Now let's go directly to the specific operation and actual effect .
Get your hands on it
Locate the software installation location
It is recommended to use the right-click software shortcut , Open the form where the file is located . For example, here I amLocate the template storage location
The template storage location can refer to my , No version VS The relative path is the same , stay 2008 and 2013 The two versions have been compared . stay “Common7\IDE\ItemTemplatesCache\CSharp\Code\2052”Find the specific template that needs to be modified
Class Below the folder is the class file templateModify the template content
This is what I add according to the company code specification CLR edition 、 Namespace 、 The template content after the modification of customized content such as machine name . Everyone can modify it according to actual needs , Here is a photo of the template parameter list ./*---------------------------------------------------------------- // Copyright 2019 FreeLoopPowter.All rights reserved. // File name : Outpatient order template selection control // File function description : Outpatient order template selection control // The design requirements : Realize outpatient prescription template , Find and select functions // // CLR edition : $clrversion$ // class name call : $itemname$ // Machine name : $machinename$ // Namespace : $rootnamespace$ // writing Pieces of name : $safeitemname$ // The creator : FreeLoopPowter // Date of creation : $time$ // Modify the record : // log1: Reviser : // modification date : // Modify the content : // log2: Reviser : // modification date : // Modify the content : //----------------------------------------------------------------*/ using System; using System.Collections.Generic; $if$ ($targetframeworkversion$ == 3.5)using System.Linq; $endif$using System.Text; namespace $rootnamespace$ { /// <summary> /// Object name : Outpatient order template selection control /// Object content : Outpatient order template selection control /// The creator : FreeLoopPowter /// Date of creation : $time$ /// Reviser : /// modification date : /// </summary> public class $safeitemrootname$ { } }
Restart software
Open software
Add a new class file in the project to see the effect , As shown below :/*---------------------------------------------------------------- // Copyright 2019 FreeLoopPowter.All rights reserved. // File name : Class file template demo class // File function description : Class file template demo class // The design requirements : Demo class file template effect // // CLR edition : 4.0.30319.42000 // class name call : Class1 // Machine name : DESKTOP-70OTVC2 // Namespace : BarCodeAndQRCode // writing Pieces of name : Class1 // The creator : FreeLoopPowter // Date of creation : 2019/7/7 11:55:44 // Modify the record : // log1: Reviser : // modification date : // Modify the content : // log2: Reviser : // modification date : // Modify the content : //----------------------------------------------------------------*/ using System; using System.Collections.Generic; using System.Text; namespace BarCodeAndQRCode { /// <summary> /// Object name : Class file template demo class /// Object content : Class file template demo class /// The creator : FreeLoopPowter /// Date of creation : 2019/7/7 11:55:44 /// Reviser : /// modification date : /// </summary> public class Class1 { } }
Be diligent in practice 、 Willing to record , Love to share .
边栏推荐
- Matplotlib drawing interface settings
- 怎样写一个增广矩阵到txt文件中
- OpenGL configuration vs2019
- Song list 11111
- Which financial products will yield high returns in 2022?
- DNS series (I): why does the updated DNS record not take effect?
- The essence of analog Servlet
- Jerry's manual matching method [chapter]
- OpenGL job coordinate system
- ByteDance Android interview, summary of knowledge points + analysis of interview questions
猜你喜欢
[JDBC Part 1] overview, get connection, CRUD
How to make agile digital transformation strategy for manufacturing enterprises
South China x99 platform chicken blood tutorial
Kirin Xin'an operating system derivative solution | storage multipath management system, effectively improving the reliability of data transmission
强化学习-学习笔记9 | Multi-Step-TD-Target
Jerry's about TWS channel configuration [chapter]
Latest Android advanced interview questions summary, Android interview questions and answers
L2:ZK-Rollup的现状,前景和痛点
cv2.resize函数报错:error: (-215:Assertion failed) func != 0 in function ‘cv::hal::resize‘
Pre sale 179000, hengchi 5 can fire? Product power online depends on how it is sold
随机推荐
OpenGL jobs - shaders
Reptile combat (VII): pictures of the king of reptiles' heroes
The whole network "chases" Zhong Xuegao
Matplotlib drawing interface settings
Win11时间怎么显示星期几?Win11怎么显示今天周几?
How to write an augmented matrix into TXT file
Wechat official account oauth2.0 authorizes login and displays user information
Jerry's fast pairing does not support canceling pairing [article]
MIT6.S081-Lab9 FS [2021Fall]
Pre sale 179000, hengchi 5 can fire? Product power online depends on how it is sold
How to realize the movement control of characters in horizontal game
Interview question 01.02 Determine whether it is character rearrangement - auxiliary array algorithm
What is the difference between the three values of null Nan undefined in JS
Automatic classification of defective photovoltaic module cells in electronic images
Which financial products will yield high returns in 2022?
Ant destination multiple selection
应用实践 | 数仓体系效率全面提升!同程数科基于 Apache Doris 的数据仓库建设
2022 how to evaluate and select low code development platforms?
【Azure微服务 Service Fabric 】因证书过期导致Service Fabric集群挂掉(升级无法完成,节点不可用)
23. Merge K ascending linked lists -c language