日期:2014-05-17 浏览次数:20541 次
class A
{
public string Text;
}
class Test:ICloneable
{
public A a = new A();
public object Clone()
{
return this.MemberwiseClone();
}
}
protected void Page_Load(object sender, EventArgs e)
{
Test t = new Test();
t.a.Text = "A";
Response.Write(t.a.Text);
Test t1 = (Test)t.Clone();
t.a.Text = "B";
Response.Write(t1.a.Text);
}
------解决方案--------------------
对引用类型字段复制包括它的引用和它的内容
-------------
这一句有点歧义...这里“它的引用”所指向的地址已经不同于源对象的地址了,只是引用的类型相同...