Método TextTransformation.Write (String)
Acrescenta uma cópia da cadeia de caracteres especificada 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 Write ( _
textToAppend As String _
)
public void Write(
string textToAppend
)
public:
void Write(
String^ textToAppend
)
member Write :
textToAppend:string -> unit
public function Write(
textToAppend : String
)
Parâmetros
textToAppend
Tipo: StringA cadeia de caracteres a acrescentar.
Exceções
Exceção | Condição |
---|---|
ArgumentOutOfRangeException | Ampliar o valor de StringBuilder subjacente puder exceder MaxCapacity. |
Comentários
O método de Write pode ser usado diretamente em um modelo de texto.
Exemplos
O exemplo de código a seguir demonstra chame o método de Write 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
- Confiança total para o chamador imediato. O membro não pode ser usado por código parcialmente confiável. Para obter mais informações, consulte Usando bibliotecas de código parcialmente confiável.
Consulte também
Referência
Namespace Microsoft.VisualStudio.TextTemplating