我刚刚开始在我的 C# 项目中使用StringTemplate 。我浏览了文档,但似乎找不到实现这个简单场景的方法:
我有一个简单的业务对象列表(比如说订单),我希望它们显示在我的 html 模板内的 UL 标记中。
所以,我的 .st 模板看起来像这样(伪代码):
<html> some text <ul>[Order template]<li>[Order name here]</li>[/Order template]</ul></html>
我希望我的输出是:
<html> some text <ul><li>Order 1</li><li>Order 2</li>...</ul></html>
我不知道如何使用 StringTemplate 来完成这项工作。有任何想法吗?