C# 当LINQ语句没有where子句时,为什么没有intellisense?
有人能告诉我为什么我不使用此代码获取intellisense吗C# 当LINQ语句没有where子句时,为什么没有intellisense?,c#,linq,intellisense,C#,Linq,Intellisense,有人能告诉我为什么我不使用此代码获取intellisense吗 var testDocuments = (from u in db.TestDocuments orderby u.WhenCreated descending select u). var testDocuments = (from u in db.TestDocuments orderby u.When
var testDocuments = (from u in db.TestDocuments
orderby u.WhenCreated descending
select u).
var testDocuments = (from u in db.TestDocuments
orderby u.WhenCreated descending
where 1==1
select u).
但是我可以通过以下代码获得intellisense:
var testDocuments = (from u in db.TestDocuments
orderby u.WhenCreated descending
select u).
var testDocuments = (from u in db.TestDocuments
orderby u.WhenCreated descending
where 1==1
select u).
当我遇到这种问题时,我会稍微改变一下我的编码风格:
var testDocuments = (from u in db.TestDocuments
orderby u.WhenCreated descending
select u).
转化为
var testDocuments = db.TestDocuments.OrderBy(u => u.WhenCreated).
假设Linq对象是有效的,它将调出intellisense。我也处于类似的情况,然后我添加了以下行
using System.Linq;
你使用的是Resharper还是Code Rush?我看到的都一样,只有VS Express。我也在使用Resharper(4.5,VS2008),这对我来说是不可复制的。我在这两种情况下都获得了智能…第一种是
IOrderedEnumerable
,但这不重要。我使用的VS2008没有Resharper,也许Resharper可以纠正它?你的意思是:为什么只为OrderBy
编写查询表达式?我想这是一个很好的观点。这是第一个解决方案,总是在涉及LINQ时检查。