views:

175

answers:

1

Can anyone tell me why I do not get intellisense with this code:

var testDocuments = (from u in db.TestDocuments
                     orderby u.WhenCreated descending
                     select u).

but I do get intellisense with this code:

var testDocuments = (from u in db.TestDocuments
                     orderby u.WhenCreated descending
                     where 1==1
                     select u).
+2  A: 

When I run into this kind of problem I switch my coding style a little:

var testDocuments = (from u in db.TestDocuments
                     orderby u.WhenCreated descending
                     select u).

Translates into

var testDocuments = db.TestDocuments.OrderBy(u => u.WhenCreated).

And assuming the Linq object is valid it will pull up the intellisense.

thaBadDawg
What you're saying is: why write a query expression just for `OrderBy`? Good point, I guess.
Kobi