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
- Pełne zaufanie do bezpośredniego wywołującego. Tego elementu członkowskiego nie można używać w kodzie częściowo zaufanym. Aby uzyskać więcej informacji, zobacz Przy użyciu bibliotek z częściowo zaufanego kodu..
Zobacz też
Informacje
Przestrzeń nazw Microsoft.VisualStudio.TextTemplating