다음을 통해 공유


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 네임스페이스

기타 리소스

연습: 사용자 지정 텍스트 템플릿 호스트 만들기