Hi All,
I have a item list, it contains a category. i want to group by the list using category in LINQ.
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Manas MohapatraRank #182 · 13.2K reputationPosted Dec 1, 2016, 8:22 AM EST
MayankRank #4,018 · 371 reputationPosted Dec 9, 2016, 1:02 AM EST
public class PriceLog { public DateTime LogDateTime {get; set;} public int Price {get; set;} }If you need to get list of PriceLog objects:
var query = from p in PriceLogList group p by p.LogDateTime.ToString("MMM yyyy") into g select new PriceLog { LogDateTime = DateTime.Parse(g.Key), GoldPrice = (int)g.Average(x => x.GoldPrice), SilverPrice = (int)g.Average(x => x.SilverPrice) };
If it resolve your issue then mark as answer.