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

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

Example (note the case):

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

What are

30条回答
  •  -上瘾入骨i
    2020-11-21 05:17

    There's a quote on this issue from Daniel Solis' book.

    All the predefined types are mapped directly to underlying .NET types. The C# type names (string) are simply aliases for the .NET types (String or System.String), so using the .NET names works fine syntactically, although this is discouraged. Within a C# program, you should use the C# names rather than the .NET names.

提交回复
热议问题