The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

TextTransformation.PopIndent Method ()


Removes the most recently added text from CurrentIndent.

Namespace:   Microsoft.VisualStudio.TextTemplating
Assembly:  Microsoft.VisualStudio.TextTemplating.12.0 (in Microsoft.VisualStudio.TextTemplating.12.0.dll)

public string PopIndent()

Return Value

Type: System.String

A String that contains the text most recently added to CurrentIndent. CurrentIndent is commonly called without capturing the return value.

The CurrentIndent represents text that is prefixed to each line of the generated text output. The indent text can be spaces only, for example "    ", or it can include words. PushIndent adds text to CurrentIndent, and can be called more then once. PopIndent removes the most recently added text from CurrentIndent, and can be called more than once. ClearIndent removes all text from the CurrentIndent.

The following code example demonstrates calling the PopIndent method from a text template. Paste this code into any text template file and run the text template transformation to see the results.

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


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

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


This example produces the following output:

Indent1> Indent2> Test

Indent1> The previous indent was: Indent2>


Return to top