How to: Add a Statement to Text Templates
Updated: July 2008
You can use text templates to generate code, XML, reports, or other artifacts from models. You can use Statement Syntax blocks to add Visual Basic or Visual C# code to your template. The code should be expressed by using the language that is declared in the language parameter of the template directive.
To add a statement to a text template
In text templates, use an opening "<#" tag and a closing "#>" tag to delineate code statements. Add statement tags to your text template with code, as shown in the following example.
In this example, the code loops through each ModelType in ClassModel.Types.
For an example about how to create a fully coded and running text template, see Walkthrough: Creating and Running Text Templates