Udostępnij za pośrednictwem


Metoda TextTransformation.PopIndent —

Usuwa ostatnio dodany tekst z CurrentIndent.

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

Składnia

'Deklaracja
Public Function PopIndent As String
public string PopIndent()
public:
String^ PopIndent()
member PopIndent : unit -> string 
public function PopIndent() : String

Wartość zwracana

Typ: System.String
A String zawierający tekst ostatnio dodana do CurrentIndent.CurrentIndent często nazywa się bez przechwytywanie zwracanej wartości.

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 wywołania PopIndent 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");

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()
#>

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

Indent1> Indent2> Test

Indent1> The previous indent was: Indent2>

Test

Zabezpieczenia programu .NET Framework

Zobacz też

Informacje

TextTransformation Klasa

Przestrzeń nazw Microsoft.VisualStudio.TextTemplating

CurrentIndent

PushIndent

ClearIndent

Inne zasoby

Kod generacji i szablony tekst T4