Last active
December 15, 2015 04:58
-
-
Save bjartwolf/5205026 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using Antlr4.StringTemplate; | |
namespace stringtemplatetest | |
{ | |
class Bjorn | |
{ | |
public Bjorn(int alder) | |
{ | |
Alder = alder; | |
} | |
public int Alder { get; set; } | |
} | |
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
var bjorns = new List<Bjorn> | |
{ | |
new Bjorn(43), | |
new Bjorn(43), | |
new Bjorn(3) | |
}; | |
var hello = new Template("<ul> $bjorns: { bjorn | <li> Bjørnen er : $bjorn.Alder$</li>}$</ul>", '$', '$'); | |
hello.Add("bjorns", bjorns); | |
Console.Out.WriteLine(hello.Render()); | |
Console.ReadLine(); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment