C# 无奖竞猜:两行 Console.WriteLine
分别输出什么?
🏷️ C#
csharp
static void Main(string args)
{
StringBuilder builder = new StringBuilder("world, ");
AppendHello(builder);
Console.WriteLine(builder.ToString());
ClearBuilder(builder);
Console.WriteLine(builder.ToString());
Console.ReadLine();
}
static void AppendHello(StringBuilder builder)
{
builder.Append("hello!");
}
static void ClearBuilder(StringBuilder builder)
{
builder = null;
}
点击查看输出结果
world, hello!
world, hello!