다음을 통해 공유


TextTransformation.PopIndent 메서드

CurrentIndent에서 가장 최근에 추가된 텍스트를 제거합니다.

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

구문

‘선언
Public Function PopIndent As String
public string PopIndent()
public:
String^ PopIndent()
member PopIndent : unit -> string
public function PopIndent() : String

반환 값

형식: String
CurrentIndent 에 가장 최근 추가된 텍스트가 포함된 String입니다.일반적으로 CurrentIndent는 반환 값을 캡처하지 않고 호출됩니다.

설명

CurrentIndent는 생성된 텍스트 출력 각 줄 맨 앞에 있는 텍스트를 나타냅니다. 들여쓰기 텍스트는 공백(예: "    ")만 있거나, 단어를 포함할 수 있습니다. PushIndent은 텍스트를 CurrentIndent에 추가하고 두 번 이상 호출될 수 있습니다. PopIndent는 가장 최근에 추가된 텍스트를 CurrentIndent에서 제거하고 두 번 이상 호출할 수 있습니다. ClearIndentCurrentIndent에서 텍스트를 모두 제거합니다.

예제

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

<#
PushIndent("Indent1>  ");
PushIndent("Indent2>  ");

WriteLine("Test");

string previous = PopIndent();
WriteLine("The previous indent was: {0}", previous);

PopIndent();  //Pop without capturing the return value.
WriteLine("Test");

ClearIndent();
#>
<#
PushIndent("Indent1>  ")
PushIndent("Indent2>  ")

WriteLine("Test")

Dim previous as String = PopIndent()
WriteLine("The previous indent was: {0}", previous)

PopIndent()  'Pop without capturing the return value.
WriteLine("Test")

ClearIndent()
#>

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

Indent1> Indent2> Test

Indent1> The previous indent was: Indent2>

Test

.NET Framework 보안

참고 항목

참조

TextTransformation 클래스

Microsoft.VisualStudio.TextTemplating 네임스페이스

CurrentIndent

PushIndent

ClearIndent

기타 리소스

코드 생성 및 T4 텍스트 템플릿