Sdílet prostřednictvím


TextTransformation.Write – metoda (String)

Připojí výstup generovaný text kopii zadaného řetězce.

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

Syntaxe

'Deklarace
Public Sub Write ( _
    textToAppend As String _
)
public void Write(
    string textToAppend
)
public:
void Write(
    String^ textToAppend
)
member Write : 
        textToAppend:string -> unit 
public function Write(
    textToAppend : String
)

Parametry

Výjimky

Výjimka Podmínka
ArgumentOutOfRangeException

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

Poznámky

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

Příklady

Následující příklad kódu ukazuje volání Write 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

Write – přetížení

Microsoft.VisualStudio.TextTemplating – obor názvů

GenerationEnvironment

StringBuilder

MaxCapacity

ArgumentOutOfRangeException

Další zdroje

How to: Append Text to the Generated Text