c#是区分大小写的呀,为何 new String() 与 new string() 效果完全相同呢?            char[] s = { 'a','b','c','d','!'};
            string str;
            str = new String(s);
            Console.WriteLine(str);
            string str1 = new string(s);
            Console.WriteLine(str1);
正规的写法:应该写成 new String() 呢,还是写成 new string() 才规范呀?

解决方案 »

  1.   

    String 是强类型string 类型表示零或更多 Unicode 字符组成的序列。string 是 .NET Framework 中 String 的别名。
      

  2.   

    其实,String是CLR的类型名称(也算是keyword),而string是C#中的keyword。在C#的编译时,默认会增加几行代码,看了你就会明白string和String的区别了!
    using string = System.String; using sbyte = System.SByte; using byte = System.Byte; using short = System.Int16; using ushort = System.UInt16; using int = System.Int32; using uint = System.UInt32; ... ...
      

  3.   

    String是类名
    string是.NET Framework中给它设定的别名, 是一个关键字,效果是一样的
      

  4.   

    http://wenku.baidu.com/view/559d02cdda38376baf1faefa.htmlhttp://social.msdn.microsoft.com/Forums/zh-CN/visualcshartzhchs/thread/eb088692-6f4b-4ac3-94ab-5a368e40a45e
      

  5.   

    string 是 String 的别名,
    这么说, String才是正名呀。
    可是又说 string 是c#的关键字,String竟然不是c#的关键字。到底 String ,string ,谁是最根本的呀?
      

  6.   

    补充一句使用String必须using System;
    使用string不需要引用任何命名空间。这就是String和string的唯一区别
      

  7.   

    String 是个类string是一个关键字
      

  8.   


    +1   正解 
    看东西不能看表面   你深入的去FW 了解    多去MSDN 搜搜
      

  9.   

    string 是String的马甲
    String本身是类型,
    而string的行为伪装的像个值,为的是让程序员方便使用具体参见MSDN的 string(C# 参考):
    http://msdn.microsoft.com/zh-cn/library/362314fe(VS.80).aspx