An open source template engine for C#

 

[Click here to return to the main page of this project]

Description of template elements

For a description of the Template class and its methods, refer to the Html documentation.

Template Tag
Description
<%@ Assembly Name="System.Xml" %>
references and assembly that can be accessed in the current template
<%@ Import NameSpace="System.Threading" %> imports a namespace for use in the current template
<%@ Argument Name="name" Type="string" %> declares a template parameter called name of type string; parameters must be passed to the generate(...) method and provided there in order of definition in the template.
<%@ Include File="another.template" %>
includes a template in the current template; you can therefore better organize your template files

<script runat="template">
int global_counter = 0;

private string F()
{
  return global_counter.ToString();
}
</script>

defines helper variables and functions that can be called in your template
<% for(int i=0; i<100; i++) { %> introduces a code block in the template which will be executed (don't forget to close braces, e.g. by somewhere later writing "<% } %>")
<%=name%> evaluates expression "name" and writes its result to the output
<% Response.Write("Hello!"); %> directly writes to the output stream, this is sometimes useful
 

[Click here to return to the main page of this project]