惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

博客园 - 叶小钗
云风的 BLOG
云风的 BLOG
G
Google Developers Blog
S
SegmentFault 最新的问题
罗磊的独立博客
Hugging Face - Blog
Hugging Face - Blog
美团技术团队
爱范儿
爱范儿
博客园 - 三生石上(FineUI控件)
H
Hackread – Cybersecurity News, Data Breaches, AI and More
D
DataBreaches.Net
F
Fortinet All Blogs
TaoSecurity Blog
TaoSecurity Blog
D
Docker
C
Cybersecurity and Infrastructure Security Agency CISA
K
Kaspersky official blog
宝玉的分享
宝玉的分享
腾讯CDC
Google Online Security Blog
Google Online Security Blog
Recorded Future
Recorded Future
T
The Exploit Database - CXSecurity.com
T
The Blog of Author Tim Ferriss
V
V2EX
S
Securelist
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
C
CERT Recently Published Vulnerability Notes
A
Arctic Wolf
Scott Helme
Scott Helme
L
LINUX DO - 热门话题
Y
Y Combinator Blog
P
Proofpoint News Feed
T
Tor Project blog
AWS News Blog
AWS News Blog
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
The Last Watchdog
The Last Watchdog
博客园 - 聂微东
T
Threat Research - Cisco Blogs
B
Blog
Attack and Defense Labs
Attack and Defense Labs
L
Lohrmann on Cybersecurity
C
CXSECURITY Database RSS Feed - CXSecurity.com
阮一峰的网络日志
阮一峰的网络日志
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
IT之家
IT之家
N
News and Events Feed by Topic
博客园 - 司徒正美
H
Help Net Security
C
Cisco Blogs
C
Check Point Blog
S
Secure Thoughts

博客园 - Felix Liang

精进 Spring Boot 03:Spring Boot 的配置文件和配置管理,以及用三种方式读取配置文件 精进 Spring Boot 02 | Spring Boot 的文档结构、POM 文件格式的介绍,以及 Maven 的使用。 精进 Spring Boot 01 | Spring Boot 入门,用 Spring Boot 写第一个 Hello World How do I get started with Node.js 修改xampp的mysql默认密码和端口 Visual Studio 2013 错误系统找不到指定文件,0x80070002 Daily Build H公司数据同步的总结 VB2010新特性之——标识语言版本的新命令行选项/langversion (Visual Basic) 为什么开发人员不能估算时间? [翻译]SQL Server 未公开的两个存储过程sp_MSforeachtable 和 sp_MSforeachdb 获取应用程序的根Url - Felix Liang - 博客园 Lambda 表达式 Lambda Expressions (Visual Basic) 集合初始化器概览(Visual Basic) 宽松委托转换(Relaxed delegate conversion) 自动实现属性 Visual Basic 2010 新特性 VS2008 Tips #009 – 您可以在 ASP.NET 的 Web.config 文件中注册用户控件 VS2008 Tips #008 如何创建ASP.NET Web 用户控件并包含在Web 页面中 - Felix Liang
VB2010 的隐式续行(Implicit Line Continuation)
Felix Liang · 2010-05-17 · via 博客园 - Felix Liang

VB2010 的隐式续行(Implicit Line Continuation)

许多情况下,您可以让 VB 后一行继续前一行的语句,而不必使用下划线(_)。下面列举出隐式续行语法的使用情形。

1、逗号“,”之后

Public Function GetUsername(ByVal username As String,
                            
ByVal delimiter As Char,
                            
ByVal position As IntegerAs StringReturn username.Split(delimiter)(position)
End Function

2、左括号之后,或右括号之前:

Dim username = GetUsername(
    Security.Principal.WindowsIdentity.GetCurrent().Name,
    
CChar("\"),
    
1
  )

3、左大括号之后,或者右大括号之前:    

Dim customer = New Customer With {
  .Name 
= "Terry Adams",
  .Company 
= "Adventure Works",
  .Email 
= "terry@www.adventure-works.com"
}

4、XML 文本中的开嵌入表达式(open embedded expression)“<%=”之后,或者闭嵌入表达式(close of an embedded expression)“%>”之前:

Dim customerXml = <Customer>
                      
<Name>
                          
<%=
                              customer.Name
                          %
>
                      
</Name>
                      
<Email>
                          
<%=
                              customer.Email
                          %
>
                      
</Email>
                  
</Customer>

5、字符串连接符“&”之后

cmd.CommandText =
    
"SELECT * FROM Titles JOIN Publishers " &
    
"ON Publishers.PubId = Titles.PubID " &
    
"WHERE Publishers.State = 'CA'"

6、赋值符号之后,如(=, &=, :=, +=, -=, *=, /=, \=, ^=, <<=, >>=)

Dim fileStream =
  My.Computer.FileSystem.
    OpenTextFileReader(filePath)

7、表达式中二元运算符之后,如(+, -, /, *, Mod, <>, <, >, <=, >=, ^, >>, <<, And, AndAlso, Or, OrElse, Like, Xor)

Dim memoryInUse =
  My.Computer.Info.TotalPhysicalMemory 
+
  My.Computer.Info.TotalVirtualMemory 
-
  My.Computer.Info.AvailablePhysicalMemory 
-
  My.Computer.Info.AvailableVirtualMemory

8、Is 或 IsNot 运算符后

If TypeOf inStream Is
  IO.FileStream 
AndAlso
  inStream 
IsNot
  
Nothing Then

    ReadFile(inStream)

End If

9、成员修饰符(member qualifier character)“.”之后,并且在成员名称之前。然而,当您使用 With 语句或者给类型的初始化列表(initialization list)提供成员时,必须在成员修饰符“.”后面加上下划线“_”。当您使用 With 语句或对象初始化列表(object initialization lists)时,可以在赋值符号(如“=”)后面换行。


Dim fileStream =
  My.Computer.FileSystem.
    OpenTextFileReader(filePath)

...

' 不允许这样:
'
 Dim aType = New With { .
'
    PropertyName = "Value"

' 可以这样:
Dim aType = New With {.PropertyName =
    
"Value"}Dim log As New EventLog()' 不可以这样:
'
 With log
'
    .
'
      Source = "Application"
'
 End With

' 可以这样:
With log
    .Source 
=
      
"Application"
End With

10、XML 轴属性修饰符(XML axis property qualifier)后面,如“.”、“.@”、“...”的后面。然而,当你使用 With 关键字时,标识成员修饰符,你必须包含下划线。

Dim customerName = customerXml.
  
<Name>.ValueDim customerEmail = customerXml...
  
<Email>.Value

11、标识属性类(Attribute)时,小于号(<)之后或者大于号(>)之前。还有标识属性类时,大于号后面也可隐藏连接符。但是,当您标识程序集级别或者模块级别的属性类时,必须用连接符“_”。

<
Serializable()
>
Public Class Customer
    
Public Property Name As String
    
Public Property Company As String
    
Public Property Email As String
End Class

12、查询运算符(query operators)之前或之后,包括 Aggregate, Distinct, From, Group By, Group Join, Join, Let, Order By, Select, Skip, Skip While, Take, Take While, Where, In, Into, On, Ascending, and Descending。若查询运算符由多个单词构成,您不可以在它们中间换行,如Order By, Group Join, Take While, 和 Skip While。

Dim vsProcesses = From proc In
                    Process.GetProcesses
                  Where proc.MainWindowTitle.Contains(
"Visual Studio")
                  
Select proc.ProcessName, proc.Id,
                         proc.MainWindowTitle

13、For Each 语句的 In 关键字后

For Each p In
  vsProcesses

    Console.WriteLine(

"{0}" & vbTab & "{1}" & vbTab & "{2}",
      p.ProcessName,
      p.Id,
      p.MainWindowTitle)
Next

   

14、集合初始化器的 From 关键字后

Dim days = New List(Of String) From
  {
   
"Mo""Tu""We""Th""F""Sa""Su"
  }

原文参见:http://msdn.microsoft.com/en-us/library/865x40k4.aspx