using System.Collections.Generic;
using System.Globalization;
public static void Main()
var datetime = DateTime.ParseExact("290430", "yyMMdd", CultureInfo.InvariantCulture);
Console.WriteLine(datetime.ToString());
static List<Product> ProductList = new List<Product>
new Product {Name = "aa", Price = 12.9, Description = "zzz", ProductId = "123",title="ttt"},
new Product {Name = "bb", Price = 555, Description = "yy", ProductId = "456"}
static void TestForLiquid()
TemplateContext context = new TemplateContext
TemplateLoader = new LiquidTemplateLoader() ,
MemberRenamer = member => member.Name,
var test = "{% include 'products.liquid' %}";
Template template = Template.Parse(test, lexerOptions: new LexerOptions { Mode = ScriptMode.Liquid });
ScriptObject scriptObject1 = new ScriptObject();
scriptObject1["products"] = ProductList;
context.PushGlobal(scriptObject1);
var text = template.Render(context);
Console.WriteLine("Result: \n {0}" ,text);
public string Name { get; set; }
public double Price { get; set; }
public string Description { get; set; }
public string ProductId { get; set; }
public string title { get; set; }
class LiquidTemplateLoader : ITemplateLoader
public string GetPath(TemplateContext context, SourceSpan callerSpan, string templateName)
public string Load(TemplateContext context, SourceSpan callerSpan, string templatePath)
{% assign p=products[0] %}
{% for product1 in products %}
<h2>{{ product1.Name }}</h2>
Price: {{ product1.Price }}
ProductId: {{product1.ProductId}}
description: {{ product1.Description }}
Console.WriteLine("Loading Template '{0}': \n {1}" ,templatePath,text);