大哥来救命啊!!
using System;
using System.Collections.Generic;
using System.Text;
namespace ConsoleApplication36
{
class Program
{
static void Main(string[] args)
{
string sb = "A";
StringBuilder sb1 = new StringBuilder("B");
operate(sb, sb1);
string c = sb.Insert(1, "C");
Console.WriteLine(sb + " " + sb1 + " " + c);
Console.ReadLine();
}
static void operate(string a, StringBuilder b)
{
a.Insert(1, "b");
b.Append("lalala");
}
}
}
为什么sb的值没变而sb1的值变了啊,它们不都是传递的引用么?
sb1的值又为什么会变啊?
哪位大哥给我讲讲清楚啊,我还不明白啊
我在java版里面也问了一个类似的问题
http://community.csdn.net/Expert/topic/5231/5231989.xml?temp=.6940729
有50分