Simple application of C # Chinese text template (. tt)

Source: Internet
Author: User

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)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.