Udostępnij za pośrednictwem


Metoda TextTransformation.ClearIndent —

Resetuje CurrentIndent ciąg pusty.

Przestrzeń nazw:  Microsoft.VisualStudio.TextTemplating
Zestaw:  Microsoft.VisualStudio.TextTemplating.12.0 (w Microsoft.VisualStudio.TextTemplating.12.0.dll)

Składnia

'Deklaracja
Public Sub ClearIndent
public void ClearIndent()
public:
void ClearIndent()
member ClearIndent : unit -> unit
public function ClearIndent()

Uwagi

CurrentIndent Reprezentuje tekst, który ma prefiks, aby każdy wiersz danych wyjściowych wygenerowany tekst.Wcięcia tekstu może być spacji, na przykład "", lub może zawierać słów.PushIndentWstawia napis do CurrentIndenti może być wywoływana więcej, a następnie jeden raz.PopIndentusuwa ostatnio dodany tekst z CurrentIndenti może być wywoływana więcej niż raz.ClearIndentUsuwa cały tekst z CurrentIndent.

Przykłady

Poniższy przykład kodu demonstruje, jak wywoływać ClearIndent metoda z szablonu tekstu.Wklej ten kod do dowolnego pliku tekstowego, szablon i uruchamiania transformacja szablon tekst, aby zobaczyć wyniki.

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

PushIndent("Indent3>  ");
PushIndent("Indent4>  ");
WriteLine("Test");

ClearIndent();

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

PushIndent("Indent3>  ")
PushIndent("Indent4>  ")
WriteLine("Test")

ClearIndent()

WriteLine("Test")
#>

Ten przykład generuje następujące wyniki:

Indent1> Indent2> Test

Indent1> Indent2> Indent3> Indent4> Test

Test

Zabezpieczenia programu .NET Framework

Zobacz też

Informacje

TextTransformation Klasa

Przestrzeń nazw Microsoft.VisualStudio.TextTemplating

CurrentIndent

PushIndent

PopIndent

Inne zasoby

Generowanie kodu i szablony tekstowe T4