C# Language

T4 Code Generation

Syntax#

  • T4 Syntax
  • <#@...#> //Declaring properties including templates, assemblies and namespaces and the language the template uses
  • Plain Text //Declaring text that can be looped through for the files generated
  • <#=...#> //Declaring Scripts
  • <#+...#> //Declaring scriptlets
  • <#...#> //Declaring text blocks

Runtime Code Generation

<#@ template language="C#" #> //Language of your project 
<#@ assembly name="System.Core" #>
<#@ import namespace="System.Linq" #>
<#@ import namespace="System.Text" #>
<#@ import namespace="System.Collections.Generic" #>

This modified text is an extract of the original Stack Overflow Documentation created by the contributors and released under CC BY-SA 3.0 This website is not affiliated with Stack Overflow