本文整理汇总了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.