📜  C#中的字符串和字符串有什么区别? - C# 代码示例

📅  最后修改于: 2022-03-11 14:48:41.886000             🧑  作者: Mango

代码示例2
string place = "world";
string greet = String.Format("Hello {0}!", place);

/* string is an alias in C# for System.String.
So technically, there is no difference. It's like int vs. System.Int32.

As far as guidelines, it's generally recommended to use string any time you're referring to an object.

e.g.
*/
string place = "world";
/*
Likewise, I think it's generally recommended to use String if you
need to refer specifically to the class.

e.g.
*/
string greet = String.Format("Hello {0}!", place);