Class Feature Syntax

You can use the class feature blocks in your text templates to add helper functions. Helper functions enable you to avoid repeating common code. The general syntax is:

<#+ FeatureCode #>

The following code sample shows you how to use the class feature:

<#+
private string FixWhiteSpaces(string s)
{
    return(Regex.Replace(s," ","").ToString());
}
#>

Debugging

To debug text templates, you must set the debug parameter of the template directive. For more information, see How to: Debug Text Templates.

Security

For more information, see Security of Text Templates.

See Also

Concepts

How to: Add Helper Functions to Text Templates

Adding Code to Text Templates

Using Built-in Directives in Text Templates

Generating Artifacts Using Text Templates

Walkthrough: Creating and Running Text Templates