TextTransformation.Write - метод (String)
Добавляет копию указанной строки в конце созданного выходного текста.
Пространство имен: Microsoft.VisualStudio.TextTemplating
Сборка: Microsoft.VisualStudio.TextTemplating.10.0 (в Microsoft.VisualStudio.TextTemplating.10.0.dll)
Синтаксис
'Декларация
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
)
Параметры
- textToAppend
Тип: System.String
Добавляемая строка.
Исключения
Исключение | Условие |
---|---|
ArgumentOutOfRangeException | При увеличении значения базового StringBuilder будет превышено значение MaxCapacity. |
Заметки
Метод Write может использоваться непосредственно в текстовом шаблоне.
Примеры
В следующем примере кода показан вызов метода Write из текстового шаблона. Вставьте этот код в любой файл шаблона текста и запустите преобразование шаблона текста, чтобы увидеть результаты.
<#
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
#>
В этом примере получается следующий результат:
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
- Полное доверие для непосредственно вызывающего метода. Этот член не может быть использован частично доверенным кодом. Дополнительные сведения см. в разделе Использование библиотек из не вполне надежного кода.
См. также
Ссылки
Microsoft.VisualStudio.TextTemplating - пространство имен