Share via


DirectiveProcessor.Initialize Method

When overridden in a derived class, initializes the processor instance.

Namespace:  Microsoft.VisualStudio.TextTemplating
Assembly:  Microsoft.VisualStudio.TextTemplating.11.0 (in Microsoft.VisualStudio.TextTemplating.11.0.dll)

Syntax

'Declaration
Public Overridable Sub Initialize ( _
    host As ITextTemplatingEngineHost _
)
public virtual void Initialize(
    ITextTemplatingEngineHost host
)
public:
virtual void Initialize(
    ITextTemplatingEngineHost^ host
)
abstract Initialize : 
        host:ITextTemplatingEngineHost -> unit  
override Initialize : 
        host:ITextTemplatingEngineHost -> unit
public function Initialize(
    host : ITextTemplatingEngineHost
)

Parameters

Implements

IDirectiveProcessor.Initialize(ITextTemplatingEngineHost)

Remarks

Initialize is called before StartProcessingRun, and gives the directive processor the opportunity to get information it needs from the host.

You can throw an exception during Initialize to stop the processing.

Examples

The following code example shows a possible implementation for a custom directive processor. This code example is part of a larger example provided for the DirectiveProcessor class.

private int directiveCount;

public override void Initialize(ITextTemplatingEngineHost host)
{
    directiveCount = 0;
}
Private directiveCount As Integer

Public Overrides Sub Initialize(ByVal host As ITextTemplatingEngineHost)

    directiveCount = 0
End Sub

.NET Framework Security

See Also

Reference

DirectiveProcessor Class

Microsoft.VisualStudio.TextTemplating Namespace

ITextTemplatingEngineHost

LogErrors

StartProcessingRun

Initialize

Other Resources

Creating Custom T4 Text Template Directive Processors

Walkthrough: Creating a Custom Directive Processor