次の方法で共有


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 テキスト テンプレート ディレクティブ プロセッサの作成

チュートリアル: カスタム ディレクティブ プロセッサの作成