Created
December 8, 2017 18:08
-
-
Save mythz/568447d1019a339d4504c7d3b9752e5b to your computer and use it in GitHub Desktop.
Templates List Dictionary Example
This file contains 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.Linq; | |
using System.Collections.Generic; | |
using ServiceStack; | |
using ServiceStack.Text; | |
using ServiceStack.Templates; | |
var __Contacts = new List<Dictionary<string,object>> { | |
new Dictionary<string,object> { | |
{ "Title", "foo" }, | |
}, | |
new Dictionary<string,object> { | |
{ "Title", "bar" }, | |
}, | |
}; | |
var context = new TemplateContext { | |
Args = { | |
{ "__Contacts", __Contacts } | |
} | |
}.Init(); | |
var output = context.EvaluateTemplate("{{ __Contacts | select('<td>{{ it.Title}}</td>') }}"); |
This file contains 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
<?xml version="1.0" encoding="utf-8"?> | |
<packages> | |
<package id="ServiceStack.Text" version="4.5.14" targetFramework="net45" /> | |
<package id="ServiceStack.Client" version="4.5.14" targetFramework="net45" /> | |
<package id="ServiceStack.Interfaces" version="4.5.14" targetFramework="net45" /> | |
<package id="ServiceStack.Common" version="4.5.14" targetFramework="net45" /> | |
</packages> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment