Partilhar via


Método TextTransformation.WriteLine (String)

Acrescenta uma cópia da cadeia de caracteres especificada e a linha terminador padrão para a saída gerada de texto.

Namespace:  Microsoft.VisualStudio.TextTemplating
Assembly:  Microsoft.VisualStudio.TextTemplating.12.0 (em Microsoft.VisualStudio.TextTemplating.12.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: String

    A cadeia de caracteres a gravação.

Exceções

Exceção Condição
ArgumentOutOfRangeException

Ampliar o valor de StringBuilder subjacente puder exceder MaxCapacity.

Comentários

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

Exemplos

O exemplo de código a seguir demonstra chame o método de WriteLine de um modelo de texto. Cole o código em qualquer 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
#>

Este exemplo gera 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 to the Generated Text