i am trying to consolidate an ienumerable list that i am serializing
i have data that looks like this:
Internet explorer 10
Internet explorer 15
Mozille firefox 10
I was it to look like:
Internet explorer 25
Mozille firefox 10
my class looks like:
public class BrowserVisits
{
public string BrowserName { get; set; }
public int Visits { get; set; }
}
my current query to serialize an ienumerable list (r) looks like:
var browserVisits = from r in reportData
select new BrowserVisits
{
BrowserName = r.Dimensions.First(d => d.Key == Dimension.Browser).Value,
Visits = int.Parse(r.Metrics.First(d => d.Key == Metric.Visits).Value)
};
how do i go a group by with sum in linq?
do i need to go two queries, or can i do a single one.
apologies if this sounds vague, its been a long day, but am more than happy to add to this if it needs clarification