加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

VB.NET中的内联LINQ注释

发布时间:2020-12-17 07:22:33 所属栏目:百科 来源:网络整理
导读:有没有办法在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 D
有没有办法在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

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读