Anonymous Type. How to solve this?

S

shapper

Hello,

I am getting a anonymous type from Linq Query inside a function.
How can I return the obtained values and use them outside the
function?

Do I need to create a new class?

Here is my code:

Public Shared Function GetStats() As ??????????????????

Dim database As New CodeDataContext
Dim statistics = database.Tags.Select( _
Function(t) New With { _
Key .Total = database.Tags.Count(), _
Key .Linked = database.Tags.Where( _
Function(tag) _
tag.FilesTags.Any() OrElse _
tag.ArticlesTags.Any()).Count() _
}).FirstOrDefault()

Return statistics ???????????????????

End Function

Thanks,
Miguel
 
G

Guest

 Hello,

I am getting a anonymous type from Linq Query inside a function.
How can I return the obtained values and use them outside the
function?

Do I need to create a new class?

Here is my code:

    Public Shared Function GetStats() As ??????????????????

      Dim database As New CodeDataContext
      Dim statistics = database.Tags.Select( _
      Function(t) New With { _
        Key .Total = database.Tags.Count(), _
        Key .Linked = database.Tags.Where( _
          Function(tag) _
            tag.FilesTags.Any() OrElse _
            tag.ArticlesTags.Any()).Count() _
      }).FirstOrDefault()

      Return statistics ???????????????????

    End Function

Thanks,
Miguel

Maybe you can use an Object data type?
 
S

shapper

Maybe you can use an Object data type?

Yes, but the type properties are not recognized by my editor outside
the function ...

.... maybe I will create a class and return that class.

Thanks,
Miguel
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,178
Messages
2,570,955
Members
47,509
Latest member
Jack116

Latest Threads

Top