Método TextTransformation.WriteLine (String)

Anexa uma cópia da seqüência de caracteres especificada e o terminador de linha padrão para a saída de texto gerado.

Namespace:  Microsoft.VisualStudio.TextTemplating
Assembly:  Microsoft.VisualStudio.TextTemplating.10.0 (em Microsoft.VisualStudio.TextTemplating.10.0.dll)

Sintaxe

'Declaração
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: System.String
    A seqüência de caracteres para escrever.

Exceções

Exceção Condição
ArgumentOutOfRangeException

Aumentando o valor de base StringBuilder excederia MaxCapacity.

Comentários

O WriteLine método pode ser usado diretamente em um modelo de texto.

Exemplos

O exemplo de código a seguir demonstra a chamada a WriteLine método a partir de um modelo de texto. Cole este código no arquivo de modelo de texto e executar a transformação do modelo de texto para ver os 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
#>

Esse exemplo produz a seguinte saída.

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.

Segurança do .NET Framework

Consulte também

Referência

TextTransformation Classe

Sobrecargas WriteLine

Namespace Microsoft.VisualStudio.TextTemplating

GenerationEnvironment

StringBuilder

MaxCapacity

ArgumentOutOfRangeException

Outros recursos

How to: Append Text to the Generated Text