TextTransformation.ClearIndent Method ()


Resets the CurrentIndent to an empty string.

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

public void ClearIndent()

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 how to call the ClearIndent 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>  ");

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



This example produces the following output:

Indent1> Indent2> Test

Indent1> Indent2> Indent3> Indent4> Test


Return to top