
using System.Collections.Generic
using System.Linq
using System.Textnamespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
StringBuilder sbu = new StringBuilder("这是一个初始化字符串 ")
sbu.AppendLine("这是一个用AppendLine添加的字符串 ")
sbu.Append("注意,这个字符串是在AppendLine之后,换行输出了")
sbu.Append("注意,这个字符串是在Append之后,没有换行输出")
Console.WriteLine(sbu.ToString())
}
}
}
AppendLine=Append(字符串\\n)
sb.AppendLine("string2") 是添加换行stringBuilder可以做参数,但是它本身是一个类,不能直接作为string输出,必须用 ToString() 才行。
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)