简体   繁体   English

字符串有什么区别? 和 c# 中的字符串

[英]What difference between string? and string in c#

Could you explain what difference between string?你能解释一下字符串之间的区别吗? and string.和字符串。 When we use ?我们什么时候用? in values type it means that variable can contains null, but what does it mean for reference type string?在值类型中,这意味着变量可以包含空值,但是对于引用类型字符串意味着什么?

Thanks!谢谢!

In C#, a String and a string are exactly the same thing.在 C# 中, Stringstring是完全相同的东西。 The object String has been encapsulated by the string "data type" for simplicity purposes.为简单起见,对象String已被string “数据类型”封装。 Strings, in fact, are not a data type, but an object.实际上,字符串不是数据类型,而是对象。

Since a string is an object, it, therefore, is nullable.由于字符串是对象,因此它可以为空。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM