本文整理汇总了C#中ITemplate.AsText方法的典型用法代码示例。如果您正苦于以下问题:C# ITemplate.AsText方法的具体用法?C# ITemplate.AsText怎么用?C# ITemplate.AsText使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ITemplate
的用法示例。
在下文中一共展示了ITemplate.AsText方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: BuildTarget
/// <summary>
/// Helper method that builds a template target.
/// </summary>
/// <param name="target">The target name.</param>
/// <param name="outputDirectory">The output directory for the file.</param>
/// <param name="template">The template to use.</param>
protected void BuildTarget(string target, string outputDirectory, ITemplate template, ConventionType format = ConventionType.PascalCase )
{
template.Target = target;
File.WriteAllText(
Path.Combine(outputDirectory, target.Convention(format) + this.Extension),
template.AsText(this.Indent)
);
template.Clear();
}
示例2: BuildType
/// <summary>
/// Helper method that builds a template target.
/// </summary>
/// <param name="type">The target type.</param>
/// <param name="outputDirectory">The output directory for the file.</param>
/// <param name="template">The template to use.</param>
protected void BuildType(CustomType type, string outputDirectory, ITemplate template, ConventionType format = ConventionType.PascalCase)
{
template.TargetType = type;
File.WriteAllText(
Path.Combine(outputDirectory, type.Name.Convention(format) + this.Extension),
template.AsText(this.Indent)
);
template.Clear();
}
示例3: BuildOperation
/// <summary>
/// Helper method that builds a template target.
/// </summary>
/// <param name="operation">The target operation.</param>
/// <param name="outputDirectory">The output directory for the file.</param>
/// <param name="template">The template to use.</param>
protected void BuildOperation(Operation operation, string outputDirectory, ITemplate template, ConventionType format = ConventionType.PascalCase)
{
template.TargetOperation = operation;
File.WriteAllText(
Path.Combine(outputDirectory, operation.Name.Convention(format) + this.Extension),
template.AsText(this.Indent)
);
template.Clear();
}