Sdílet prostřednictvím


ITextTemplatingEngineHost.ResolveParameterValue – metoda

Pokud není zadán parametr v textu šablony řeší hodnotu parametru směrnice procesoru.

Obor názvů:  Microsoft.VisualStudio.TextTemplating
Sestavení:  Microsoft.VisualStudio.TextTemplating.Interfaces.10.0 (v Microsoft.VisualStudio.TextTemplating.Interfaces.10.0.dll)

Syntaxe

'Deklarace
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

Parametry

  • directiveId
    Typ: System.String
    ID směrnice volání, do které patří parametr.Toto ID disambiguates ze stejné šablony text Opakovaná volání téže směrnice.
  • processorName
    Typ: System.String
    Název směrnice procesoru, do které patří směrnice.

Vrácená hodnota

Typ: System.String
A String , představuje hodnotu parametru vyřešen.

Poznámky

Tuto metodu lze volat ze směrnice procesoru nebo kód šablony text získat hodnoty z hostitele text šablony. Obvykle směrnice procesoru bude volat metodu získat výchozí hodnotu pro parametr této směrnice.

Například v hostiteli, který spustí nástroj příkazového řádku TextTransform.exe, tato metoda načítá hodnoty z –a možností příkazového řádku. Další informace naleznete v tématu Generování Soubory s TextTransform Nástroj.

Příklady

Následující příklad kódu ukazuje možné provedení vlastního hostitele. Příklad kódu je součástí větší příklad. Pro plný příklad, viz Walkthrough: Vytváření Uživatelský text šablona hostitel.

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

Zabezpečení rozhraní .NET Framework

Viz také

Odkaz

ITextTemplatingEngineHost Rozhraní

Microsoft.VisualStudio.TextTemplating – obor názvů

Další zdroje

Walkthrough: Vytváření Uživatelský text šablona hostitel