摘要: //引用类型(使用了class)class SomeRef{public Int32 x;}//值类型(使用了struct)struct SomeVal{public Int32 x;}static void ValueTypeDemo(){ //引用类型在堆上分配空间,值类型在栈上分配,都用new初始化为0 SomeRef r1 = new SomeRef(); SomeRef v1 = new SomeVal(); //引用类型提领指针,值类型直接修改内容 r1.x = 5; v1.y = 5; //都显示5 Console.WriteLin... 阅读全文
posted @ 2013-11-14 09:04 iEvent 阅读(344) 评论(0) 推荐(0) 编辑