Transfer from http://www.it165.net/pro/html/201409/21789.html
These two days do the project Tuyu. tt files, not previously contacted, so query learning to do notes, help memory and later.
Click Select Text template in the project add
Put the code below and make a simple comment
01.<#@ template debug="false" hostspecific="false" language="C#" #>02.<#@ assembly name="System.Core" #>03.<#@ import namespace="System.Linq" #>04.<#@ import namespace="System.Text" #>05.<#@ import namespace="System.Collections.Generic" #>06.<#@ output extension=".cs" #> //生成的文件格式,文件名称同文本模板名称相同07. 08.//正文09.<# var user_obj = new string [] {"Name", "Age", "Education"}; #>10.class AutoCreate11.{12.<# for(int i= 0; i< user_obj.Length ; i ++){ #>13.public static string <#= user_obj[i] #>;14.<# }#>15.}1.观察一下<#= #>这种输出格式和asp.net在页面上输出时写<%= %>是一个模式.2.<# context #>中的context就被编译器直接运行,而<# context #>之外的内容当做文本直接输出<br><br>Ctrl+s save, automatically generate CS file, very good very powerful!
The END
Simple application of C # Chinese text template (. tt)