本文整理匯總了VB.NET中System.Text.StringBuilder.AppendLine方法的典型用法代碼示例。如果您正苦於以下問題:VB.NET StringBuilder.AppendLine方法的具體用法?VB.NET StringBuilder.AppendLine怎麽用?VB.NET StringBuilder.AppendLine使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類System.Text.StringBuilder
的用法示例。
在下文中一共展示了StringBuilder.AppendLine方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的VB.NET代碼示例。
示例1: Sample
' This example demonstrates the StringBuilder.AppendLine()
' method.
Imports System.Text
Class Sample
Public Shared Sub Main()
Dim sb As New StringBuilder()
Dim line As String = "A line of text."
Dim number As Integer = 123
' Append two lines of text.
sb.AppendLine("The first line of text.")
sb.AppendLine(line)
' Append a new line, an empty string, and a null cast as a string.
sb.AppendLine()
sb.AppendLine("")
sb.AppendLine(CStr(Nothing))
' Append the non-string value, 123, and two new lines.
sb.Append(number).AppendLine().AppendLine()
' Append two lines of text.
sb.AppendLine(line)
sb.AppendLine("The last line of text.")
' Convert the value of the StringBuilder to a string and display the string.
Console.WriteLine(sb.ToString())
End Sub
End Class
輸出:
The first line of text. A line of text. 123 A line of text. The last line of text.