当前位置:网站首页>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$ { } }
Template parameter list 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 .
边栏推荐
- ByteDance senior engineer interview, easy to get started, fluent
- OpenGL homework - Hello, triangle
- Display optimization when the resolution of easycvr configuration center video recording plan page is adjusted
- Restapi version control strategy [eolink translation]
- How polardb-x does distributed database hotspot analysis
- 648. Word replacement
- 戴森官方直营店免费造型服务现已开放预约 先锋科技诠释护发造型理念,助力消费者解锁多元闪耀造型
- 大数据开源项目,一站式全自动化全生命周期运维管家ChengYing(承影)走向何方?
- Dry goods sharing | devaxpress v22.1 original help document download collection
- Debugging and handling the problem of jamming for about 30s during SSH login
猜你喜欢
How does win11 unblock the keyboard? Method of unlocking keyboard in win11
反爬通杀神器
DNS series (I): why does the updated DNS record not take effect?
100million single men and women "online dating", supporting 13billion IPOs
Wechat official account oauth2.0 authorizes login and displays user information
Crawler (17) - Interview (2) | crawler interview question bank
South China x99 platform chicken blood tutorial
Why can't win11 display seconds? How to solve the problem that win11 time does not display seconds?
应用实践 | 数仓体系效率全面提升!同程数科基于 Apache Doris 的数据仓库建设
Win11时间怎么显示星期几?Win11怎么显示今天周几?
随机推荐
The maximum number of meetings you can attend [greedy + priority queue]
OpenGL jobs - shaders
How to realize the movement control of characters in horizontal game
Two kinds of updates lost and Solutions
NVR硬盘录像机通过国标GB28181协议接入EasyCVR,设备通道信息不显示是什么原因?
Code of "digital image processing principle and Practice (matlab version)" part2[easy to understand]
How does win11 time display the day of the week? How does win11 display the day of the week today?
Cv2.resize function reports an error: error: (-215:assertion failed) func= 0 in function ‘cv::hal::resize‘
Wechat official account oauth2.0 authorizes login and displays user information
MIT6.S081-Lab9 FS [2021Fall]
用语雀写文章了,功能真心强大!
【colmap】稀疏重建转为MVSNet格式输入
ByteDance Android interview, summary of knowledge points + analysis of interview questions
Dbsync adds support for mongodb and ES
South China x99 platform chicken blood tutorial
Matplotlib drawing interface settings
Tupu digital twin coal mining system to create "hard power" of coal mining
It's worth seeing. Interview sites and interview skills
应用实践 | 数仓体系效率全面提升!同程数科基于 Apache Doris 的数据仓库建设
Restore backup data on persistent volumes