Share via


DirectiveProcessor.Initialize Method

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

Namespace:  Microsoft.VisualStudio.TextTemplating
Assembly:  Microsoft.VisualStudio.TextTemplating.12.0 (in Microsoft.VisualStudio.TextTemplating.12.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

  • host
    Type: ITextTemplatingEngineHost

    The ITextTemplatingEngineHost of the DirectiveProcessor. The DirectiveProcessor can request information about the file system or the external environment from host.

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

StartProcessingRun

Initialize

Other Resources

Creating Custom T4 Text Template Directive Processors

Walkthrough: Creating a Custom Directive Processor