C#和StringBuilder。我是C#的新手。我无法理解输出

时间:2017-03-17 12:10:39

标签: c# stringbuilder

using System;
using System.Text;

namespace Objects
{
    class Program
    {
        static void Main(string[] args)
        {
            StringBuilder x = new StringBuilder(), y = x;
            x.Append("Hello, ");
            y.Append("World");
            Console.WriteLine(x.ToString());//prints Hello, World
            Console.WriteLine(y.ToString());//prints Hello, World
            x = null;
            Console.WriteLine(x); // produces NullString
            Console.WriteLine(y.ToString()); //prints Hello, World.How does it print Hello, World
            Console.ReadLine();

        }
    }
}

0 个答案:

没有答案