PC Review


Reply
Thread Tools Rate Thread

Anonymous Type. How to solve this?

 
 
shapper
Guest
Posts: n/a
 
      6th Mar 2008
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
 
Reply With Quote
 
 
 
 
Alexey Smirnov
Guest
Posts: n/a
 
      6th Mar 2008
On Mar 6, 3:41*pm, shapper <mdmo...@gmail.com> wrote:
> *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?
 
Reply With Quote
 
shapper
Guest
Posts: n/a
 
      6th Mar 2008
On Mar 6, 7:38 pm, Alexey Smirnov <alexey.smir...@gmail.com> wrote:
> On Mar 6, 3:41 pm, shapper <mdmo...@gmail.com> wrote:
>
>
>
> > 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?


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
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Determine whether type is anonymous? Anders Borum Microsoft C# .NET 6 26th Dec 2009 09:12 PM
How to do anonymous type in .net 2.0 mohaaron Microsoft C# .NET 2 16th Sep 2009 01:45 AM
Anonymous Type. How to solve this? shapper Microsoft VB .NET 3 7th Mar 2008 04:43 AM
Anonymous type etc. in C# 3.0 Chris Dunaway Microsoft C# .NET 17 16th Sep 2005 05:59 AM
how to solve NT AUTHORITY\ANONYMOUS log fail c0371 Microsoft ASP .NET 1 31st Jan 2004 08:27 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 09:58 AM.