-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProgram.cs
More file actions
37 lines (34 loc) · 1.05 KB
/
Program.cs
File metadata and controls
37 lines (34 loc) · 1.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
using System;
using System.IO;
using Scriban;
namespace html
{
class Program
{
class Item
{
public string name { get; set; }
public int quantity { get; set; }
public string unit { get; set; }
}
static Item[] items = { new Item { name = "milk", quantity = 1, unit = "l" },
new Item { name = "potato", quantity = 2, unit = "kg" },
};
static void Main(string[] args)
{
var fileName = "template.sbn";
var content = File.ReadAllText(fileName);
var template = Template.Parse(content, fileName);
var result = template.Render(new {
UserName = "User Name",
Address = "3 Smith St, Smithville",
Items = items
});
var path = @".\index.html";
using (StreamWriter sw = File.CreateText(path))
{
sw.Write(result);
}
}
}
}