vb.net - 在 VB.NET 中连接字符串的 & 与 plus

标签 vb.net string-concatenation

在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/

相关文章:

batch-file - 连接两个字符串 'present working directory' 和 'app.exe' 文件名以构建绝对路径

python - 为什么 join() 不自动将其参数转换为字符串?你什么时候不想让它们成为字符串?

vb.net - Mercury Quick Test Pro 和虚拟机 : Works from one client machine but not another

java - 编译器何时不隐式使用 StringBuffer/StringBuilder?

python - 为什么'new_file + = line + string'比'new_file = new_file + line + string'快得多?

VB.Net - 如何支持隐式类型转换和自定义相等性

delphi - Delphi中的字符串: Pre-allocate memory to increase performance in simple cases?

mysql - 奇怪的行为 - 对于相同的 SQL,phpMyAdmin 和 VS 2017 中的结果不同

vb.net - 帮我选择 .net 混淆器程序?

Java Try Catch block