Use whatever you and your team find the most readable.
(使用您和您的团队最容易阅读的内容。)
Other answers have suggested that a new string is created every time you use ""
.
(其他答案表明,每次使用""
都会创建一个新字符串。)
This is not true - due to string interning, it will be created either once per assembly or once per AppDomain (or possibly once for the whole process - not sure on that front). (这是不正确的-由于字符串内部操作,它会针对每个程序集创建一次,也可能针对每个AppDomain创建一次(或者对于整个过程可能创建一次-不确定在那方面)。)
This difference is negligible - massively, massively insignificant. (这种差异可以忽略不计-在很大程度上,在很大程度上是微不足道的。)
Which you find more readable is a different matter, however.
(但是,您发现更具可读性的是另一回事。)
It's subjective and will vary from person to person - so I suggest you find out what most people on your team like, and all go with that for consistency. (它是主观的,并且因人而异-因此,我建议您找出团队中大多数人都喜欢的东西,并且为了保持一致性,所有人都应该这样做。)
Personally I find ""
easier to read. (我个人觉得""
更易于阅读。)
The argument that ""
and " "
are easily mistaken for each other doesn't really wash with me.
(""
和" "
容易被误认为是我的观点。)
Unless you're using a proportional font (and I haven't worked with any developers who do) it's pretty easy to tell the difference. (除非您使用比例字体(并且我没有与任何开发者合作过),否则很容易分辨出区别。)
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…