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