共用方式為


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 文字範本指示詞處理器

逐步解說:建立自訂指示詞處理器