Adding Code to Text Templates
You can use Visual Basic or Visual C# code to control how the text that results from processing the template is generated based on input data. Code blocks fall into three categories: statements, expressions, and class features.
In This Section
Text Syntax (Domain-Specific Languages)
Explains the role of text blocks in text templates.Statement Syntax
Explains the role of statements in text templates and shows the syntax for using them.Expression Syntax (Domain-Specific Languages)
Explains the role of expressions in text templates and shows the syntax for using them.Class Feature Syntax
Explains the role of class features in text templates and shows the syntax for using them.How to: Add a Statement to Text Templates
Lists the steps to add a statement to a text template and gives an example.How to: Add an Expression to Text Templates
Lists the steps to add an expression to a text template and gives an example.How to: Add Helper Functions to Text Templates
Lists the steps to add a class feature to a text template and gives an example.How to: Generate Errors and Warnings from Text Templates
Lists the steps to generate errors and warnings from text templates using the Error and Warning methods.How to: Append Text to the Generated Text
Lists the steps to append text to the generated text using the Write and WriteLine methods.
Reference
Domain-Specific Language Tools Reference
Related Sections
Using Built-in Directives in Text Templates
Contains topics that explain using built-in directives, such as output and include, in text templates.Architecture of Text Templates
Contains topics that discuss the architecture of the text template transformation process in detail.Text Template Walkthroughs
Contains walkthroughs that provide step-by-step instructions for common text template scenarios.Generating Artifacts Using Text Templates
Describes the use of text templates to generate artifacts such as text reports, code, or HTML files.Domain-Specific Language Tools Glossary
Defines key terms that are used in the Help for Domain-Specific Language Tools.