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

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

Example (note the case):

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

What are

30条回答
  •  鱼传尺愫
    2020-11-21 05:25

    I prefer the capitalized .NET types (rather than the aliases) for formatting reasons. The .NET types are colored the same as other object types (the value types are proper objects, after all).

    Conditional and control keywords (like if, switch, and return) are lowercase and colored dark blue (by default). And I would rather not have the disagreement in use and format.

    Consider:

    String someString; 
    string anotherString; 
    

提交回复
热议问题