TextTransformation.Write 메서드 (String)

지정된 문자열의 복사본을 생성된 텍스트 출력에 추가합니다.

네임스페이스:  Microsoft.VisualStudio.TextTemplating
어셈블리:  Microsoft.VisualStudio.TextTemplating.10.0(Microsoft.VisualStudio.TextTemplating.10.0.dll)

구문

‘선언
Public Sub Write ( _
    textToAppend As String _
)
public void Write(
    string textToAppend
)
public:
void Write(
    String^ textToAppend
)
member Write : 
        textToAppend:string -> unit 
public function Write(
    textToAppend : String
)

매개 변수

  • textToAppend
    형식: System.String
    추가할 문자열입니다.

예외

예외 상황
ArgumentOutOfRangeException

내부 StringBuilder의 값이 커지면 MaxCapacity를 초과할 수 있는 경우

설명

Write 메서드는 텍스트 템플릿에서 직접 사용할 수 있습니다.

예제

다음 코드 예제에서는 텍스트 템플릿에서 Write 메서드를 호출하는 것을 보여 줍니다. 이 코드를 모든 텍스트 템플릿에 붙여넣고 텍스트 템플릿 변환을 실행하여 결과를 봅니다.

<#  
    string text = @"This is text to append to my output file.";

    Write(text);            //Using the Write method
    WriteLine(null);        //Using the WriteLine method
    WriteLine(null);        //Using the WriteLine method
    
    for(int i=1; i<4; i++)
    {
        WriteLine(text);    //Using the WriteLine method
    }
#>
<#  
    Dim text as String = "This is text to append to my output file."
    Dim i as Integer = 0

    Write(text)            'Using the Write method
    WriteLine(Nothing)     'Using the WriteLine method
    WriteLine(Nothing)     'Using the WriteLine method
    
    For i = 1 To 3

        WriteLine(text)    'Using the WriteLine method
    Next
#>

이 예제의 결과는 다음과 같습니다.

This is text to append to my output file.

    

This is text to append to my output file.

This is text to append to my output file.

This is text to append to my output file.

.NET Framework 보안

  • 직접 실행 호출자의 경우 완전히 신뢰합니다. 이 멤버는 부분적으로 신뢰할 수 있는 코드에서 사용할 수 없습니다. 자세한 내용은 부분 신뢰 코드에서 라이브러리 사용을 참조하십시오.

참고 항목

참조

TextTransformation 클래스

Write 오버로드

Microsoft.VisualStudio.TextTemplating 네임스페이스

GenerationEnvironment

StringBuilder

MaxCapacity

ArgumentOutOfRangeException

기타 리소스

How to: Append Text to the Generated Text