After reading this post i realized that i cannot pass an anonymous type as a parameter to a function. So what other options do i have?
Perhaps, passing a Query.ToList as parameter would help, or am i re-inventing the wheel?
Update: I have the following query, which i would like to pass to a function:
Sub Test
Dim Query = (From c In DB Select New With { .ElementName = c.Name })
DoSomething(Query)
End sub
Private Function DoSomething(ByVal Q as object) as string
Dim Query = From c In Q Select c
End Function
And the error i get is
Expression of type ‘Object’ is not queryable
The post is telling lies. Of course you can pass anonymous types to a method.
In either case, your definition of
DoSomethingwas the problem since of courseObjectisn’t a queryable object.ToListdoesn’t help at all, since the result is still a collection of anonymous types.