Compartir a través de


TextTransformation.PopIndent (Método)

Quita el texto agregado recientemente de CurrentIndent.

Espacio de nombres:  Microsoft.VisualStudio.TextTemplating
Ensamblado:  Microsoft.VisualStudio.TextTemplating.11.0 (en Microsoft.VisualStudio.TextTemplating.11.0.dll)

Sintaxis

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

Valor devuelto

Tipo: System.String
Un valor de tipo String que contiene el último texto agregado a CurrentIndent.Se suele llamar a CurrentIndent sin capturar el valor devuelto.

Comentarios

CurrentIndent representa texto que se lleva como prefijo cada línea de la salida de texto generada.La sangría aplicada al texto puede ser sólo espacios, por ejemplo "    ", o puede incluir palabras.PushIndent agrega texto a CurrentIndenty se puede llamar más de una vez.PopIndent quita el último texto agregado de CurrentIndenty se puede llamar más de una vez.ClearIndent quita todo el texto de CurrentIndent.

Ejemplos

En el ejemplo de código siguiente se muestra la llamada al método PopIndent desde una plantilla de texto.Pegue este código en cualquier archivo de plantilla del texto y ejecute la transformación de plantilla de texto para ver los resultados.

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

Este ejemplo produce el siguiente resultado.

Indent1> Indent2> Test

Indent1> The previous indent was: Indent2>

Test

Seguridad de .NET Framework

Vea también

Referencia

TextTransformation Clase

Microsoft.VisualStudio.TextTemplating (Espacio de nombres)

CurrentIndent

PushIndent

ClearIndent

Otros recursos

Generación de código y plantillas de texto T4