首页 > 代码库 > StringBuilder类

StringBuilder类

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            StringBuilder sb = new StringBuilder();

            sb.Append("1");
            sb.ToString();
            Console.WriteLine(sb);

            sb.Append("2");
            sb.ToString();

            sb.Append("3");
            sb.ToString();

            sb.AppendLine("4");
            sb.ToString();

            sb.AppendLine("5");
            sb.ToString();

            sb.AppendFormat("{0}{1}", 45, 56);
            sb.ToString();
        }
    }
}

 

StringBuilder类