c#中預(yù)定義的引用類型
作者:佚名 時(shí)間:2013-11-07 分享到:
1.object:所有類型的基類
2.string:string是引用類型,但特殊于其他的引用類型,修改一個(gè)string對(duì)象的值是重新生成一個(gè)新的對(duì)象而不是改變?cè)瓉韮?nèi)存的值,通過以下代碼可以很好地了解這一點(diǎn).
string hello1 = "hello world!";
hello2 = hello1;
hello1 ="hello";
console.writeline(hello1); //hello
console.writeline(hello2); //hello world!
如沒特殊注明,文章均為上海聯(lián)楷網(wǎng)絡(luò)原創(chuàng),轉(zhuǎn)載請(qǐng)注明來自:http://www.ktcbnqb.cn/hynews/20151126/n3136.html