IT:AD:Transformations:T4:Syntax:CodeBlocks
Code Blocks
Think of a *.tt file just as an *.aspx file…stuff that is written in between special angled brackets are evaluated, and stuff in between them is outputted with no transformation.
<# ... #>
There are different types of of blocks.
For an expression block, add an equals sign:
<#= ... #>
Helper methods are defined in class feature blocks:
<#+ // Class feature block
private void WriteSquareLine(int i)
{
#>
The square of <#= i #> is <#= i*i #>.
<#
}
#>
Note how the last bracket doesn't need special closure (it knows end of class scope by the content's code/bracket closure).