日期:2014-05-17 浏览次数:20758 次
public class A {
public List<B> Blst { get; set; }
}
public class B {
public int X { get; set; }
}
public class C {
public B b { get; set; }
}
static void Main(string[] args)
{
A a=new A();
a.Blst=new List<B>();
a.Blst.Add(new B() { X = 10});
a.Blst.Add(new B() { X = 20 });
C c=new C();
c.b = a.Blst[1];
Console.WriteLine(a.Blst[1].X);
Console.WriteLine(c.b.X);
a.Blst[1].X = 100;
Console.WriteLine(c.b.X);
Console.WriteLine(a.Blst[1].X);
}