gpt4 book ai didi

vb.net - VB.NET 中的内联 LINQ 注释

转载 作者:行者123 更新时间:2023-12-03 00:43:05 25 4
gpt4 key购买 nike

是否有某种方法可以在 VB.NET 的 LINQ 中插入内联代码注释?

请参阅下面的第 2 行作为需要内嵌注释的示例

Dim Jobs = (From X In DB.Jobs_Select(SearchStr, RequiresFilter)
Where X.JobStatusID < 2 -- **** INSERT INLINE COMMENT HERE ****
Order By
X.JobPriorityID Descending,
If(X.TargetDate, Date.MaxValue),
X.NeedsLit Descending,
X.HasOldArtRequests Descending,
X.HasOldLicRequests Descending
)

这在 SQL 代码中是微不足道的,坦率地说,随着 SP 变得复杂,这非常有用。如果能够在 LINQ to SQL 中执行相同的跨开发人员通信,那就太好了。

更新

这是一个适合您的测试条件。

 Dim L As New List(Of KeyValuePair(Of Integer, Integer))

Dim a = (From X In L
Where X.Key > 5 'test comment
Order By X.Value)

最佳答案

好的,伙计们,这是官方答案 - 在 VB 中不可能。 Proof .

It is REALLY annoying in VB that you cannot add inline comments to multiline LINQ statements!

更多信息:

The bad news is that this wouldn't be trivial to implement. Limitations about single-lines and comments are built into the current VB parser at too low a level. It'd require a complete rewrite of the VB parser.

The good news is that we've embarked upon such a rewrite (codenamed "Roslyn" -- there have been several articles and talks about it). It's still a way off and we're not making commitments about what/when at this stage.

-- Lucian Wischik, VB language PM

关于vb.net - VB.NET 中的内联 LINQ 注释,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12981843/

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