Sdílet prostřednictvím


TextTransformation.WriteLine – metoda (String)

Připojí výstup generovaný text kopii zadaného řetězce a výchozí zakončení řádku.

Obor názvů:  Microsoft.VisualStudio.TextTemplating
Sestavení:  Microsoft.VisualStudio.TextTemplating.10.0 (v Microsoft.VisualStudio.TextTemplating.10.0.dll)

Syntaxe

'Deklarace
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
)

Parametry

Výjimky

Výjimka Podmínka
ArgumentOutOfRangeException

Základní hodnota zvětšení StringBuilder by překročil MaxCapacity.

Poznámky

WriteLine Metodu lze použít přímo v textu šablony.

Příklady

Následující příklad kódu ukazuje volání WriteLine Metoda z textu šablony. Vložte tento kód do šablony libovolný textový soubor a spusťte transformace textu šablony výsledky.

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

Tento příklad vytvoří následující výstup:

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.

Zabezpečení rozhraní .NET Framework

Viz také

Odkaz

TextTransformation Třída

WriteLine – přetížení

Microsoft.VisualStudio.TextTemplating – obor názvů

GenerationEnvironment

StringBuilder

MaxCapacity

ArgumentOutOfRangeException

Další zdroje

How to: Append Text to the Generated Text