C#中String和string的區別

1。string是c#中的类,
String是.net Framework的类(在c# IDE中不显示深藍色,顯示為淺藍色)
string被reflector为.net Framework的String

2。如果你用string,編譯器会把它編輯成String,
所以直接用String的話,可以稍微让編譯器少做點,實際無差別吧我感覺

3。如果使用c#,建議使用string,符合規範。畢竟string始終代表System.String(1.x) 或者::System.String(2.0) ,
String只有在前面聲明了“using System;”時,尚當前namespace中無String的類型(class、struct、delegate、enum)時才等同于System.String

4。string是keyword,爾String不是,也就是說string不能作为類,結構,枚舉,字段,變量,方法,屬性等等的名稱;
String可以

posted @ 2008-06-26 17:36  荖K  阅读(1485)  评论(0编辑  收藏  举报