I have a List<T>
that is holding several objects called tc of type TwitterCollection
. Each instance of tc contains 5 properties.
The TwitterCollection class looks like this:
public class TwitterCollection
{
public string origURL { get; set; }
public string txtDesc { get; set; }
public string imgURL { get; set; }
public string userName { get; set; }
public string createdAt { get; set; }
}
I am running a Linq to objects statement as such:
var counts = from tc in sList
group tc by tc.origURL into g
orderby g.Count()
select new { myLink = g.Key, Count = g.Count() };
Now the problem I have is that I can't access any of the tc
properties. I can access the origURL
no problem, as it is assigned to g
... but the txtDesc
, imgURL
and the other properties seem inaccessible. I need the above statement in order to sort my data appropriately.
How can I modify my Linq statement to include all the other properties of tc
, plus for it to still be sorted/ordered by Count()
in the way it is now.
Appreciate any help (I'm a relative newbie)... Many thanks in advance.