it:ad:t4:syntax:codeblocks

IT:AD:Transformations:T4:Syntax:CodeBlocks

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).
  • /home/skysigal/public_html/data/pages/it/ad/t4/syntax/codeblocks.txt
  • Last modified: 2023/11/04 23:03
  • by 127.0.0.1