当前位置:网站首页>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 am
Locate 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 template
Modify 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 .
边栏推荐
- The latest Android interview collection, Android video extraction audio
- 你可曾迷茫?曾经的测试/开发程序员,懵懂的小菜C鸟升级......
- Jerry's about TWS channel configuration [chapter]
- Preparing for the interview and sharing experience
- Paint basic graphics with custompaint
- 为什么Win11不能显示秒数?Win11时间不显示秒怎么解决?
- DBSync新增对MongoDB、ES的支持
- NVR硬盤錄像機通過國標GB28181協議接入EasyCVR,設備通道信息不顯示是什麼原因?
- ByteDance senior engineer interview, easy to get started, fluent
- 【Azure微服务 Service Fabric 】因证书过期导致Service Fabric集群挂掉(升级无法完成,节点不可用)
猜你喜欢

【Azure微服务 Service Fabric 】因证书过期导致Service Fabric集群挂掉(升级无法完成,节点不可用)

Have you ever been confused? Once a test / development programmer, ignorant gadget C bird upgrade

你可曾迷茫?曾经的测试/开发程序员,懵懂的小菜C鸟升级......

L'enregistreur de disque dur NVR est connecté à easycvr par le Protocole GB 28181. Quelle est la raison pour laquelle l'information sur le canal de l'appareil n'est pas affichée?

OpenGL configuration vs2019

QT compile IOT management platform 39 alarm linkage

What if the win11u disk does not display? Solution to failure of win11 plug-in USB flash disk

Pdf document signature Guide

PKPM 2020软件安装包下载及安装教程

Ad domain group policy management
随机推荐
Reinforcement learning - learning notes 9 | multi step TD target
[开源] .Net ORM 访问 Firebird 数据库
cv2.resize函数报错:error: (-215:Assertion failed) func != 0 in function ‘cv::hal::resize‘
Implementation method of data platform landing
DNS series (I): why does the updated DNS record not take effect?
使用 BlocConsumer 同时构建响应式组件和监听状态
SAR影像质量评估
The free styling service of Dyson's official direct store is now open for appointment. Pioneer Technology interprets the styling concept of hair care and helps consumers unlock diversified and shiny s
L'enregistreur de disque dur NVR est connecté à easycvr par le Protocole GB 28181. Quelle est la raison pour laquelle l'information sur le canal de l'appareil n'est pas affichée?
Build your own website (18)
Pdf document signature Guide
【JDBC Part 1】概述、获取连接、CRUD
Redis - basic use (key, string, list, set, Zset, hash, geo, bitmap, hyperloglog, transaction)
Wechat official account oauth2.0 authorizes login and displays user information
OpenGL job - texture
Win11游戏模式怎么开启?Win11开启游戏模式的方法
Jerry's manual matching method [chapter]
Programming mode - table driven programming
PDF文档签名指南
Use camunda to do workflow design and reject operations
