gpt4 book ai didi

vb.net - VB.NET 方法链中的换行符

转载 作者:行者123 更新时间:2023-12-04 19:59:04 24 4
gpt4 key购买 nike

我试图在 VB.NET 的以下方法链中放置换行符,但我的语法不正确:

HasRequired(Function(x) x.Issue).WithMany(Function(x) x.EntityNotes).HasForeignKey(Function(x) x.IssueID)

我想要类似的东西:

HasRequired(Function(x) x.Issue)
.WithMany(Function(x) x.EntityNotes)
.HasForeignKey(Function(x) x.IssueID)

最佳答案

在 VB.Net 中,您过去总是需要 _ 来续行。这现在通常是可选的,但可以随时添加:

HasRequired(Function(x) x.Issue) _
.WithMany(Function(x) x.EntityNotes) _
.HasForeignKey(Function(x) x.IssueID)

但是,从 Visual Studio 2010 开始,您可以在许多情况下将其关闭,编译器将正确确定新“行”是否是前一行的一部分。

这包含在 Typographic and Code Conventions 中在语言文档中。

关于vb.net - VB.NET 方法链中的换行符,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11545326/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com