I am using VB .Net for this, so I don't have acces开发者_Python百科s to var
or this would be a simple matter.
Right now my query is as follows
Dim errors As IOrderedQueryable(Of IGrouping(Of String, RSError)) = (From e In db.RSErrors
Where e.UserID = "msarchet"
Group e By e.Type Into t = Group).AsEnumerable
So I used this query in LinqPad to help me determine what the object would look like. I got back a IOrderQueryable(Of RSError)
which then contained a IGrouping(Of String, RSError)
for each grouped collection of objects returned by the query.
However I ended up with the current object type of errors
as IOrderedQueryable(Of IGrouping(Of String, RSError))
because of the cast error I am getting in VS.
Unable to cast object of type 'System.Data.Linq.DataQuery
1[VB$AnonymousType_1
2[System.String,System.Collections.Generic.IEnumerable1[RSSAdmin2.RSError]]]' to type 'System.Linq.IOrderedQueryable
1[System.Linq.IGrouping2[System.String,RSSAdmin2.RSError]]'.
I'm not sure how to get rid of the VB$AnonymousType_1 Part of the returned object.
Am I even on the right track here or am I missing something completely?
Can you try the following
Dim errors = (From e In db.RSErrors
Where e.UserID = "msarchet"
Group e By e.Type Into t = Group).AsEnumerable
Doing it this way basically sets it to
Dim errors As
Object[Whatever the expression returns]
精彩评论