在VB.NET中,使用&
有什么优势吗?连接字符串而不是 +
?
例如
Dim x as String = "hello" + " there"
对比
Dim x as String = "hello" & " there"
是的,我知道对于很多字符串连接我想使用 StringBuilder
,但这更多的是一个一般性问题。
最佳答案
微软的preference供 VB 程序员使用 &
表示字符串,而不是 +
。
You can also use the + operator to concatenate strings. However, to eliminate ambiguity, you should use the & operator instead.
关于vb.net - 在 VB.NET 中连接字符串的 & 与 plus,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3006153/