Getting Started
To use this library, simply include Cutout.dll
in your project or grab
it from NuGet, and add a reference to it.
<ItemGroup>
<PackageReference Include="Cutout" Version="x.x.x">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
</ItemGroup>
Then use the Cutout.Template
attribute to define a template method.
[Template("This is a very simple example with a {{parameter}} parameter")]
public static partial void Test2(this StringBuilder builder, string parameter);
The first parameter is the StringBuilder
-like type to write to. Everything
else passed can be used in the template.
The template must be a compile-time constant string, so it can be defined
as a const
field or inline in the attribute.
private const string TemplateExample = """
A multi-line template example
with a {{parameter}} parameter.
It also has a conditional section,
{%- if parameter == "INVALID" -%}
show this text
{%- else -%}
show this text instead
{%- end -%}
""";
[Template(TemplateExample)]
public static partial void Test3(this StringBuilder builder, string parameter);