DirectiveProcessor.Initialize Method
When overridden in a derived class, initializes the processor instance.
Namespace: Microsoft.VisualStudio.TextTemplating
Assembly: Microsoft.VisualStudio.TextTemplating.10.0 (in Microsoft.VisualStudio.TextTemplating.10.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: Microsoft.VisualStudio.TextTemplating.ITextTemplatingEngineHost
The ITextTemplatingEngineHost of the DirectiveProcessor. The DirectiveProcessor can request information about the file system or the external environment from host.
Remarks
Initialize(ITextTemplatingEngineHost, CompilerErrorCollection) is called before StartProcessingRun(CodeDomProvider), and gives the directive processor the opportunity to get information it needs from the host.
You can throw an exception during Initialize(ITextTemplatingEngineHost, CompilerErrorCollection) 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
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see Using Libraries from Partially Trusted Code.
See Also
Reference
Microsoft.VisualStudio.TextTemplating Namespace
StartProcessingRun(CodeDomProvider)
Initialize(ITextTemplatingEngineHost, CompilerErrorCollection)