I have a class that looks like this:
public class BomInfo
{
public string PartNumber { get; set; }
public string Revision { get; set; }
}
I have Scriban parse and render calls similar to this:
var boms = new List<BomInfo> { new BomInfo { PartNumber = "1234-12345-12", Revision = "A" } };
var output = Scriban.Template.Parse("{{boms[0].Revision}}").Render(new { boms = boms });
Console.Out.WriteLine(output);
I was expecting the output A
, but instead I get an empty string. I know you can index lists within Scriban templates, because if I remove the property reference and just use {{boms[0]}}
as my template, I get a valid result, the same as calling .ToString()
on the object.
Am I doing something wrong, or does Scriban not support this?
As stated in https://github.com/scriban/scriban/issues/507 and the Scriban Readme,
As such, changing the template to
{{boms[0].revision}}
is required, unless I want to implement aMemberRenamer
.