Udostępnij za pośrednictwem


Metoda TextTransformation.ClearIndent —

Resetuje CurrentIndent ciąg pusty.

Przestrzeń nazw:  Microsoft.VisualStudio.TextTemplating
Zestaw:  Microsoft.VisualStudio.TextTemplating.11.0 (w Microsoft.VisualStudio.TextTemplating.11.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 jest prefiksem każdego wiersza danych wyjściowych generowanych tekstu.Wcięcia tekstu może być na przykład spacji, "", lub może zawierać słowa.PushIndentdodaje tekst do CurrentIndenti może być wywołana więcej, a następnie raz.PopIndentusuwa ostatnio dodany tekst z CurrentIndenti może być wywołana więcej niż jeden raz.ClearIndentUsuwa cały tekst z CurrentIndent.

Przykłady

Poniższy przykład kodu pokazuje sposób wywołania ClearIndent metody z szablonu tekstu.Wklej ten kod do dowolnego pliku tekstowego, szablon, a następnie uruchom transformacji tekst szablonu, 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

Kod generacji i szablony tekst T4