当前位置: 首页>>代码示例>>C#>>正文


C# ITemplate.Get方法代码示例

本文整理汇总了C#中ITemplate.Get方法的典型用法代码示例。如果您正苦于以下问题:C# ITemplate.Get方法的具体用法?C# ITemplate.Get怎么用?C# ITemplate.Get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ITemplate的用法示例。


在下文中一共展示了ITemplate.Get方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Add

		/// <summary>
		/// Set template variable value with data from template (all occurrences will be replaced)
		/// </summary>
		/// <param name="variableName">Variable name in master template file</param>
		/// <param name="template">The template.</param>
		public void Add(string variableName, ITemplate template)
		{
			if (template == null)
				return;

			Add(variableName, template.Get());
		}
开发者ID:i4004,项目名称:Simplify.Web,代码行数:12,代码来源:DataCollector.cs

示例2: Tpl

		/// <summary>
		/// Initializes a new instance of the <see cref="Tpl" /> class.
		/// </summary>
		/// <param name="template">The template.</param>
		/// <param name="title">The site title.</param>
		public Tpl(ITemplate template, string title)
		{
			if (template != null)
				Data = template.Get();

			Title = title;
		}
开发者ID:i4004,项目名称:Simplify.Web,代码行数:12,代码来源:Tpl.cs

示例3: InlineTpl

		/// <summary>
		/// Initializes a new instance of the <see cref="InlineTpl"/> class.
		/// </summary>
		/// <param name="dataCollectorVariableName">Name of the data collector variable.</param>
		/// <param name="template">The template.</param>
		public InlineTpl(string dataCollectorVariableName, ITemplate template)
		{
			if (string.IsNullOrEmpty(dataCollectorVariableName))
				throw new ArgumentNullException(nameof(dataCollectorVariableName));

			DataCollectorVariableName = dataCollectorVariableName;

			if (template != null)
				Data = template.Get();
		}
开发者ID:i4004,项目名称:Simplify.Web,代码行数:15,代码来源:InlineTpl.cs

示例4: Set_EverythingIsNull_SetCorrectly

		public void Set_EverythingIsNull_SetCorrectly()
		{
			// Assign
			_template = Template.FromString("{Model.ID} {Model.Name} {Model.EMail}");
			var model = new TestModel();

			// Act
			_template.Model(model).Set();

			// Assert
			Assert.AreEqual("  ", _template.Get());
		}
开发者ID:fr4gles,项目名称:Simplify,代码行数:12,代码来源:TemplateModelExtensionsTests.cs

示例5: TestTemplate

		private static void TestTemplate(ITemplate tpl, ITemplate masterTemplate, ITemplate testTemplate, ITemplate masterTestTemplate)
		{
			masterTemplate.Set("Title", "Hello world!!!");

			tpl.Set("ItemTitle", "Item1");

			tpl.Add("var1", 15.5m);
			tpl.Add("var1", (long)16);
			tpl.Add("var1", 17);
			tpl.Add("var1", 18.16);
			tpl.Add("var1", new object());

			tpl.Set("var2", 15.5m)
				.Set("var3", (long)16)
				.Set("var4", 17)
				.Set("var5", 18.16)
				.Set("var6", new object());

			Assert.AreEqual(testTemplate.Get(), tpl.Get());

			masterTemplate.Add("Items", tpl.GetAndRoll());

			tpl.Set("ItemTitle", "Item2");

			tpl.Add("var1", 16.5m)
				.Add("var1", (long)255)
				.Add("var1", 300)
				.Add("var1", 26.15)
				.Add("var1", new object());

			tpl.Set("var2", 10.5m);
			tpl.Set("var3", (long)1);
			tpl.Set("var4", 3);
			tpl.Set("var5", 4.1233);
			tpl.Set("var6", new object());

			tpl.Set("NotFoundItem", (ITemplate)null);

			masterTemplate.Add("Items", tpl);

			Assert.AreEqual(masterTestTemplate.Get(), masterTemplate.Get());
		}
开发者ID:fr4gles,项目名称:Simplify,代码行数:42,代码来源:IntegrationTemplateTests.cs

示例6: Set

 /// <summary>
 /// Set template variable value with text from template (all occurrences will be replaced)
 /// </summary>
 /// <param name="variableName">Variable name</param>
 /// <param name="template">Value to set</param>
 public ITemplate Set(string variableName, ITemplate template)
 {
     return template != null ? Set(variableName, template.Get()) : this;
 }
开发者ID:nora1879,项目名称:Simplify,代码行数:9,代码来源:Template.cs


注:本文中的ITemplate.Get方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。