ITextTemplatingEngineHost.ResolveParameterValue メソッド

ディレクティブ プロセッサのパラメーターがテンプレート テキストに指定されていない場合に、パラメーターの値を解決します。

名前空間:  Microsoft.VisualStudio.TextTemplating
アセンブリ:  Microsoft.VisualStudio.TextTemplating.Interfaces.10.0 (Microsoft.VisualStudio.TextTemplating.Interfaces.10.0.dll 内)

構文

'宣言
Function ResolveParameterValue ( _
    directiveId As String, _
    processorName As String, _
    parameterName As String _
) As String
string ResolveParameterValue(
    string directiveId,
    string processorName,
    string parameterName
)
String^ ResolveParameterValue(
    String^ directiveId, 
    String^ processorName, 
    String^ parameterName
)
abstract ResolveParameterValue : 
        directiveId:string * 
        processorName:string * 
        parameterName:string -> string 
function ResolveParameterValue(
    directiveId : String, 
    processorName : String, 
    parameterName : String
) : String

パラメーター

  • directiveId
    型 : System.String
    パラメーターが属するディレクティブ呼び出しの ID。同じテキスト テンプレートの同じディレクティブが繰り返し呼び出される場合に、この ID によってそれぞれの呼び出しを区別します。
  • processorName
    型 : System.String
    ディレクティブが属するディレクティブ プロセッサの名前。
  • parameterName
    型 : System.String
    解決するパラメーターの名前。

戻り値

型 : System.String
解決されたパラメーター値を表す String

解説

このメソッドをディレクティブ プロセッサで、またはテキスト テンプレートのコードから呼び出して、テキスト テンプレート ホストから値を取得できます。通常、ディレクティブ プロセッサが、ディレクティブのパラメーター用の既定値を取得するメソッドを呼び出します。

たとえば、コマンド ライン ユーティリティ TextTransform.exe で実行されるホストでは、このメソッドは、–a コマンド ライン オプションから値を取得します。詳細については、「TextTransform ユーティリティを使用したファイルの生成」を参照してください。

カスタム ホストを実装するコード例を次に示します。ここに示すコード例は、より長い例の一部です。コード例全体については、「チュートリアル: カスタム テキスト テンプレート ホストの作成」を参照してください。

public string ResolveParameterValue(string directiveId, string processorName, string parameterName)
{
    if (directiveId == null)
    {
        throw new ArgumentNullException("the directiveId cannot be null");
    }
    if (processorName == null)
    {
        throw new ArgumentNullException("the processorName cannot be null");
    }
    if (parameterName == null)
    {
        throw new ArgumentNullException("the parameterName cannot be null");
    }

    //code to provide "hard-coded" parameter values goes here
    //this code depends on the directive processors this host will interact with

    //if we cannot do better - return the empty string
    return String.Empty;
}
Public Function ResolveParameterValue(ByVal directiveId As String, ByVal processorName As String, ByVal parameterName As String) As String Implements Microsoft.VisualStudio.TextTemplating.ITextTemplatingEngineHost.ResolveParameterValue

    If directiveId Is Nothing Then
        Throw New ArgumentNullException("the directiveId cannot be null")
    End If
    If processorName Is Nothing Then
        Throw New ArgumentNullException("the processorName cannot be null")
    End If
    If parameterName Is Nothing Then
        Throw New ArgumentNullException("the parameterName cannot be null")
    End If

    'code to provide "hard-coded" parameter values goes here
    'this code depends on the directive processors this host will interact with

    'if we cannot do better - return the empty string
    Return String.Empty
End Function

.NET Framework セキュリティ

  • 直前の呼び出し元に対する完全な信頼。このメンバーは、部分的に信頼されているコードから使用することはできません。詳細については、「部分信頼コードからのライブラリの使用」を参照してください。

参照

関連項目

ITextTemplatingEngineHost インターフェイス

Microsoft.VisualStudio.TextTemplating 名前空間

その他の技術情報

チュートリアル: カスタム テキスト テンプレート ホストの作成