TextTransformation.WriteLine 메서드 (String, array<Object )

0개 이상의 서식 사양을 포함하는 서식 지정 문자열과 기본 줄 종결자를 생성된 텍스트 출력에 추가합니다. 각 서식 사양은 해당 개체 인수의 문자열 표현으로 바뀝니다.

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

구문

‘선언
Public Sub WriteLine ( _
    format As String, _
    ParamArray args As Object() _
)
public void WriteLine(
    string format,
    params Object[] args
)
public:
void WriteLine(
    String^ format, 
    ... array<Object^>^ args
)
member WriteLine : 
        format:string * 
        args:Object[] -> unit 
public function WriteLine(
    format : String, 
    ... args : Object[]
)

매개 변수

  • format
    형식: System.String
    0개 이상의 서식 사양을 포함하는 문자열입니다.
  • args
    형식: array<System.Object[]
    형식을 지정할 개체의 배열입니다.

예외

예외 상황
ArgumentNullException

format는 nullNull 참조(Visual Basic의 경우 Nothing)입니다.

또는

args는 nullNull 참조(Visual Basic의 경우 Nothing)입니다.

FormatException

format이 잘못된 경우

ArgumentOutOfRangeException

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

설명

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

예제

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

<#
    string message = @"{0}: This is text to append number {1:F}.";

    Write(message, 0, 0);          //Using the Write method
    WriteLine(null);               //Using the WriteLine method
    WriteLine(null);               //Using the WriteLine method
    
    for(int j=1; j<4; j++)
    {
        WriteLine(message, j, j);  //Using the WriteLine method
    }
#>
<#
    Dim message as String = "{0}: This is text to append number {1:F}."
    Dim j as Integer = 0

    Write(message, 0, 0)          'Using the Write method
    WriteLine(Nothing)            'Using the WriteLine method
    WriteLine(Nothing)            'Using the WriteLine method
    
    For j = 1 To 3

        WriteLine(message, j, j)  'Using the WriteLine method
    Next
#>

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

0: This is text to append number 0.00.

    

1: This is text to append number 1.00.

2: This is text to append number 2.00.

3: This is text to append number 3.00.

.NET Framework 보안

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

참고 항목

참조

TextTransformation 클래스

WriteLine 오버로드

Microsoft.VisualStudio.TextTemplating 네임스페이스

GenerationEnvironment

StringBuilder

AppendFormat

MaxCapacity

ArgumentOutOfRangeException

FormatException

ArgumentNullException

기타 리소스

형식 서식 지정

Numeric Format Strings

Date and Time Format Strings

열거형 형식 문자열

How to: Append Text to the Generated Text