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
NetXtremeDynamicTemplate 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 Safabyte; namespace CSharp { public class Sample { [STAThread] static void Main() { NetXtremeDynamicTemplate dt = new NetXtremeDynamicTemplate(); dt.LoadFromFile("Template.tpl"); string output = dt.Run(); Console.WriteLine(output); } } } | |
| VB.NET | Copy Code |
|---|---|
| Imports Safabyte Module Sample Sub Main() Dim dt As NetXtremeDynamicTemplate = New NetXtremeDynamicTemplate() Dim output As String dt.LoadFromFile("Template.tpl") output = dt.Run() Console.WriteLine(output) End Sub End Module | |


