本文整理汇总了C#中StringTemplate.Render方法的典型用法代码示例。如果您正苦于以下问题:C# StringTemplate.Render方法的具体用法?C# StringTemplate.Render怎么用?C# StringTemplate.Render使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类StringTemplate
的用法示例。
在下文中一共展示了StringTemplate.Render方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Basic
static void Basic()
{
StringTemplate stringTemplate = new StringTemplate("hello <data>");
stringTemplate.Add("data", "world");
Console.WriteLine(stringTemplate.Render());
}
示例2: StringTemplatStringAngleBracketsTest
public void StringTemplatStringAngleBracketsTest()
{
target = new StringTemplate("<hello> <world>");
target.Add("hello", "hello");
target.Add("<world>", "world");
Assert.AreEqual(2, target.ElementData.Count);
Assert.IsTrue(target.ElementData.ContainsKey("hello"));
Assert.AreEqual("hello", target.ElementData["hello"]);
Assert.IsTrue(target.ElementData.ContainsKey("world"));
Assert.AreEqual("world", target.ElementData["world"]);
Assert.AreEqual("hello world", target.Render());
}
示例3: StringTemplateRenderWhitespaceTemplateTest
public void StringTemplateRenderWhitespaceTemplateTest()
{
String excepted = " ";
target = new StringTemplate(excepted);
Assert.AreEqual(excepted, target.Render());
}
示例4: StringTemplateRenderTwoElementTemplateTest
public void StringTemplateRenderTwoElementTemplateTest()
{
target = new StringTemplate("<test1> <test2> two");
target.Add("test1", "one");
target.Add("test2", "two");
Assert.AreEqual("one two two", target.Render());
}
示例5: StringTemplateRenderOneElementRepeatedTemplateTest
public void StringTemplateRenderOneElementRepeatedTemplateTest()
{
target = new StringTemplate("one <test> <test>");
target.Add("test", "two");
Assert.AreEqual("one two two", target.Render());
}
示例6: StringTemplateRenderNoElementTemplateTest
public void StringTemplateRenderNoElementTemplateTest()
{
String excepted = "testing";
target = new StringTemplate(excepted);
Assert.AreEqual(excepted, target.Render());
}
示例7: StringTemplateRenderNoDataForElementTest
public void StringTemplateRenderNoDataForElementTest()
{
target = new StringTemplate("<test> two two");
target.Add("testing", "one");
Assert.AreEqual("<test> two two", target.Render());
}
示例8: StringTemplateRenderExtraElementDataTest
public void StringTemplateRenderExtraElementDataTest()
{
target = new StringTemplate("<test> two two");
target.Add("test", "one");
target.Add("testing", "two");
Assert.AreEqual("one two two", target.Render());
}
示例9: StringTemplateRenderEmptyTemplateTest
public void StringTemplateRenderEmptyTemplateTest()
{
String excepted = String.Empty;
target = new StringTemplate(excepted);
Assert.AreEqual(excepted, target.Render());
}
示例10: StringTemplateRenderCaseInsensitiveTest2
public void StringTemplateRenderCaseInsensitiveTest2()
{
target = new StringTemplate("<TEST> two two");
target.Add("test", "one");
Assert.AreEqual("one two two", target.Render());
}