Hi,
I have a collection of TwitterCollection objects held within a List. I am populating the TwitterCollection object (tc) via a foreach loop, and then accessing it through LINQ.
My class with its properties looks like this:
//simple field definition class
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; }
public string realURL { get; set; }
public string googleTitle { get; set; }
public string googleDesc { get; set; }
}
I then go on to populate it with a loop through a bunch of RegEx matches in a group:
var list = new List<TwitterCollection>();
foreach (Match match in matches)
{
GroupCollection groups = match.Groups;
var tc = new TwitterCollection
{
origURL = groups[1].Value.ToString(),
txtDesc = res.text,
imgURL = res.profile_image_url,
userName = res.from_user_id,
createdAt = res.created_at,
};
list.Add(tc);
}
Finally I am looking at the collection with LINQ and extracting only certain items for display:
var counts = from URL in list
group URL by URL into g
orderby g.Count()
select new { myLink = g.Key, Count = g.Count() };
The outcome of all this is a long list of the word "TwitterCollection" in count.myLink and no count of URLs...
I used to have this all working before I shifted to a generic List. Now I have moved for convenience, it won't work.
I'd seriously appreciate someone taking me out of my misery here! Thanks in advance.