What is the difference between String and string in C#?

后端 未结 30 3910
走了就别回头了
走了就别回头了 2020-11-21 04:35

Example (note the case):

string s = \"Hello world!\";
String s = \"Hello world!\";

What are

30条回答
  •  时光说笑
    2020-11-21 05:30

    Lower case string is an alias for System.String. They are the same in C#.

    There's a debate over whether you should use the System types (System.Int32, System.String, etc.) types or the C# aliases (int, string, etc). I personally believe you should use the C# aliases, but that's just my personal preference.

提交回复
热议问题