Click to Rate and Give Feedback
MSDN
MSDN Library
Visual Studio 2008
Visual Studio
Visual Studio SDK
 PopIndent Method

  Switch on low bandwidth view
This page is specific to
Microsoft Visual Studio 2008/.NET Framework 3.5

Other versions are also available for the following:
Domain-Specific Language Tools Reference
TextTransformation..::.PopIndent Method

Updated: November 2007

Removes the most recently added text from CurrentIndent.

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

Visual Basic (Declaration)
Public Function PopIndent As String
Visual Basic (Usage)
Dim instance As TextTransformation
Dim returnValue As String

returnValue = instance.PopIndent()
C#
public string PopIndent()
Visual C++
public:
String^ PopIndent()
JScript
public function PopIndent() : String

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.

C#
<#
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();
#>
Visual Basic
<#
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()
#>

This example produces the following output:

Indent1> Indent2> Test

Indent1> The previous indent was: Indent2>

Test

Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
Processing
© 2009 Microsoft Corporation. All rights reserved. Terms of Use  |  Trademarks  |  Privacy Statement
Page view tracker