This topics shows how to declare and initialize variables in your template code:
Template.tpl Copy Code
{%double db = 10.4/}
$db$
{%double db2 = 10D/}
$db2$
{%db3 = 10.3/} {! db3 is a double !}
This declares a double and assign it to value of 10.4. The output will be
10.4
10
10.3
UltimateTemplateEngine supports the following value types: bool, char, byte, sbyte, double, float, int, long, short, uint, ulong, ushort, string, fixed array, dynamic array, dictionary and .NET object.
C# Copy Code
using System;
using System.Collections.Generic;
using System.Text;
using ComponentSoft;
namespace CSharp
{
public class Sample
{
[STAThread]
static void Main()
{
TemplateEngine dt = new TemplateEngine();
dt.LoadFromFile("Template.tpl");
string output = dt.Run();
Console.WriteLine(output);
}
}
}
VB.NET Copy Code
Imports ComponentSoft
Module Sample
Sub Main()
Dim dt As TemplateEngine = New TemplateEngine()
Dim output As String
dt.LoadFromFile("Template.tpl")
output = dt.Run()
Console.WriteLine(output)
End Sub
End Module
No comments:
Post a Comment