Compartir a través de


TextTransformation.WriteLine (Método) (String)

Anexa una copia de la cadena especificada y el terminador de línea predeterminado al resultado de texto generado.

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

Sintaxis

'Declaración
Public Sub WriteLine ( _
    textToAppend As String _
)
public void WriteLine(
    string textToAppend
)
public:
void WriteLine(
    String^ textToAppend
)
member WriteLine : 
        textToAppend:string -> unit
public function WriteLine(
    textToAppend : String
)

Parámetros

  • textToAppend
    Tipo: String

    Cadena que se va a escribir.

Excepciones

Excepción Condición
ArgumentOutOfRangeException

Si se aumenta el valor de la instancia StringBuilder subyacente, se superará MaxCapacity.

Comentarios

El método WriteLine se puede utilizar directamente en una plantilla de texto.

Ejemplos

En el ejemplo de código siguiente se muestra la llamada al método WriteLine 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.

<#  
    string text = @"This is text to append to my output file.";

    Write(text);          //Using the Write method
    WriteLine(null);      //Using the WriteLine method  
    WriteLine(null);      //Using the WriteLine method  
    
    for(int i=1; i<4; i++)
    {
        WriteLine(text);  //Using the WriteLine method  
    }
#>
<#  
    Dim text as String = "This is text to append to my output file."
    Dim i as Integer = 0

    Write(text)            'Using the Write method
    WriteLine(Nothing)     'Using the WriteLine method  
    WriteLine(Nothing)     'Using the WriteLine method  
    
    For i = 1 To 3

        WriteLine(text)    'Using the WriteLine method  
    Next
#>

Este ejemplo produce el siguiente resultado.

This is text to append to my output file.

    

This is text to append to my output file.

This is text to append to my output file.

This is text to append to my output file.

Seguridad de .NET Framework

Vea también

Referencia

TextTransformation Clase

WriteLine (Sobrecarga)

Microsoft.VisualStudio.TextTemplating (Espacio de nombres)

GenerationEnvironment

StringBuilder

MaxCapacity

ArgumentOutOfRangeException

Otros recursos

How to: Append to the Generated Text