“&"是什么意思?_"在VB中是什么意思? [英] What does "& _" mean in VB?

查看:90
本文介绍了“&"是什么意思?_"在VB中是什么意思?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在将一些查询语句从旧版 VB 应用程序复制到 C# 应用程序.我不熟悉 VB,虽然看着它让我想要一个 VB(Victoria Bitter).我遇到过这样构造的查询:

I'm copying some query statements from a legacy VB app to a C# app. I am not familiar with VB, although looking at it makes me want a VB (Victoria Bitter). I have come across queries constructed like this:

*SELECT dp_duckbill_accounts.platypus_no AS duckbill, t_accounts.name AS Name " & _ 
"FROM t_accounts INNER JOIN dp_duckbill_accounts ON  t_accounts.account_no = dp_duckbill_accounts.account_no " & _
"ORDER BY dp_duckbill_accounts.platypus_no*

& _"让我停下来.如果它只是&"我认为它对应于 C# 中的+"来连接字符串.但是下划线的重点是什么?请注意,与号和下划线之间用空格分隔.

The "& _" give me pause. If it was just "&" I would think it corresponds to "+" in C# to concatenate strings. But what in the world is the point of the underscore? Note the ampersand and the underscore are separated by a space.

推荐答案

下划线是 行继续符.它允许连接包含不同的行.像这样:

The underscore is the line continuation character. It allows the concatenation to include a different line. Like so:

x = "Hello " & "World"

x = "Hello " & _
    "World"

'this won't compile (pre vb.net 2010, anyway)
    x = "Hello " & 
    "World"

MSDN 上的续行

如何:在代码中分解和组合语句 (Visual Basic)

这篇关于“&"是什么意思?_"在VB中是什么意思?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆