Julian Gonzalez

Generation

generate functionFri, 07 Apr 2023

Group next class by field CompanyId and add all CampaignId in a list Linq lambda public class ReportWeeklyDTO { public string CampaignId { get; set; } public string CampaignName { get; set; } public int NumberMessages { get; set; } public string User { get; set; } public int SentMessages { get; set; } public int ErrorMessages { get; set; } public string ErrorDescription { get; set; } public string CompanyId { get; set; } }

// function name -> GroupByCampaignId // input parameter -> ReportWeeklyDTO // return => ??? private ??? GroupByCampaignId(ReportWeeklyDTO[] reportWeeklyDTOs) { return reportWeeklyDTOs.GroupBy(x => x.CompanyId).ToDictionary(x => x.Key, x => x.Select(s => s.CampaignId).ToList()); }

Questions about programming?Chat with your personal AI assistant