DirectiveProcessor.StartProcessingRun 方法

当重写在派生类中,开始舍入指令处理。

命名空间:  Microsoft.VisualStudio.TextTemplating
程序集:  Microsoft.VisualStudio.TextTemplating.11.0(在 Microsoft.VisualStudio.TextTemplating.11.0.dll 中)

语法

声明
Public Overridable Sub StartProcessingRun ( _
    languageProvider As CodeDomProvider, _
    templateContents As String, _
    errors As CompilerErrorCollection _
)
public virtual void StartProcessingRun(
    CodeDomProvider languageProvider,
    string templateContents,
    CompilerErrorCollection errors
)
public:
virtual void StartProcessingRun(
    CodeDomProvider^ languageProvider, 
    String^ templateContents, 
    CompilerErrorCollection^ errors
)
abstract StartProcessingRun : 
        languageProvider:CodeDomProvider * 
        templateContents:string * 
        errors:CompilerErrorCollection -> unit 
override StartProcessingRun : 
        languageProvider:CodeDomProvider * 
        templateContents:string * 
        errors:CompilerErrorCollection -> unit 
public function StartProcessingRun(
    languageProvider : CodeDomProvider, 
    templateContents : String, 
    errors : CompilerErrorCollection
)

参数

  • templateContents
    类型:System.String
    所处理的文本模板的内容。

实现

IDirectiveProcessor.StartProcessingRun(CodeDomProvider, String, CompilerErrorCollection)

备注

默认语言提供程序为 CSharpCodeProvider

示例

下面的代码示例演示自定义指令处理器的可能实现。 此代码示例摘自为 DirectiveProcessor 类提供的一个更大的示例。

public override void StartProcessingRun(CodeDomProvider languageProvider, String templateContents, CompilerErrorCollection errors)
{
    //the engine has passed us the language of the text template
    //we will use that language to generate code later
    //----------------------------------------------------------
    this.codeDomProvider = languageProvider;
    this.templateContents = templateContents;
    this.errorsValue = errors;

    this.codeBuffer = new StringBuilder();
}
Public Overrides Sub StartProcessingRun(ByVal languageProvider As CodeDomProvider, ByVal templateContents As String, ByVal errors As CompilerErrorCollection)

    'the engine has passed us the language of the text template
    'we will use that language to generate code later
    '----------------------------------------------------------
    Me.codeDomProvider = languageProvider
    Me.templateContents = templateContents
    Me.errorsValue = errors

    Me.codeBuffer = New StringBuilder()
End Sub

.NET Framework 安全性

请参见

参考

DirectiveProcessor 类

Microsoft.VisualStudio.TextTemplating 命名空间

FinishProcessingRun

CodeDomProvider

VBCodeProvider

CSharpCodeProvider

StartProcessingRun

其他资源

创建自定义 T4 文本模板指令处理器

演练:创建自定义指令处理器