DirectiveBlock Class

Represents a directive block in a template.

public class DirectiveBlock : TemplateBlock
Inheritance
TemplateBlock DirectiveBlock

Constructors

NameDescription
DirectiveBlock(Template, string, int, string, string)Initializes a new instance of the DirectiveBlock class.

DirectiveBlock(Template, string, int, string, string)

DirectiveBlock.cs

Initializes a new instance of the DirectiveBlock class.

public DirectiveBlock(Template template, string text, int index, string name, string value)

Parameters

template Template
The template that contains this block.
text string
The directive content without the directive marker.
index int
The index of this block in the template.
name string
The directive name.
value string
The directive value.

Properties

NameDescription
NameGets the directive name.
ValueGets the directive value.

Gets the directive name.

public string Name { get; }

Property value

string

Gets the directive value.

public string Value { get; }

Property value

string

Methods

NameDescription
ApplyDirective()Applies the directive to the template.
BuildCode()Builds the C# code for this directive block.

ApplyDirective()

DirectiveBlock.cs

Applies the directive to the template.

public virtual void ApplyDirective()

Builds the C# code for this directive block.

public override string BuildCode()

Returns

string An empty string as directives are not emitted as executable code by default.