TextTransformation.Write-Methode (String)
Fügt eine Kopie der angegebenen Zeichenfolge an die generierte Textausgabe an.
Namespace: Microsoft.VisualStudio.TextTemplating
Assembly: Microsoft.VisualStudio.TextTemplating.10.0 (in Microsoft.VisualStudio.TextTemplating.10.0.dll)
Syntax
'Declaration
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
)
Parameter
- textToAppend
Typ: System.String
Die anzufügende Zeichenfolge.
Ausnahmen
Ausnahme | Bedingung |
---|---|
ArgumentOutOfRangeException | Wenn derWer des zugrunde liegenden StringBuilder-Elements vergrößert würde, würde MaxCapacity überschritten. |
Hinweise
Die Write-Methode kann direkt in einer Textvorlage verwendet werden.
Beispiele
Im folgenden Codebeispiel wird das Aufrufen der Write-Methode in einer Textvorlage dargestellt. Fügen Sie diesen Code in eine beliebige Textvorlagendatei ein, und führen Sie die Textvorlagentransformation aus, um die Ergebnisse zu sehen.
<#
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
#>
Dieses Beispiel erzeugt folgende Ausgabe:
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.
.NET Framework-Sicherheit
- Volle Vertrauenswürdigkeit für den unmittelbaren Aufrufer. Dieser Member kann von nur teilweise vertrauenswürdigem Code nicht verwendet werden. Weitere Informationen finden Sie unter Verwenden von Bibliotheken aus teilweise vertrauenswürdigem Code.
Siehe auch
Referenz
Microsoft.VisualStudio.TextTemplating-Namespace