我正在尝试使用 Scriban 模板引擎来替换字典值。例如
string bodyText = "Hi,
The following service(s) has reported issues.
{{emailContent}}
Thanks " ;
Dictionary<string, string> keyValuePairs = new Dictionary<string, string>()
{
{"emailContent", "UserManagement has following unhealthy subservice(s)"}
};
var template1 = Template.Parse(bodyText);
var result1 = template1.Render(new { emailContent = keyValuePairs[emailContent] });
Console.WriteLine(result1.ToString());
但我在渲染行出现错误。基本上想用字典替换那个emailContent。价值观。我知道我在渲染线上犯了一些错误。谁能指出我的错误或为此提供任何解决方案。谢谢