Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Conditioning on List Sum

It gives an error when I say condition on issues.Sum. how can I do it?

private async Task<CapabilityUtilizationPagedResultDto> GetCount(IEnumerable<CapabilityUtilizationDto> issues){
            
     var vfgrandtotal = issues.Sum(i => i.VFApprovedFinalEffort && i.SpecialRates=="test");
     var vfmd = vfgrandtotal / 19;
     return new CapabilityUtilizationPagedResultDto
                {
                    VFGrandTotal=vfgrandtotal,
                    VFMd=vfmd,
                    
                };
            }

>Solution :

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

Enumerable.Sum does not accept filtering delegate, it has overloads accepting delegate to produce a number to sum over. Try something like (based on comment assuming you want to sum all VFApprovedFinalEffort where SpecialRates is equal to test):

 var vfgrandtotal = issues
    .Where(i => i.SpecialRates == "test")
    .Sum(i => i.VFApprovedFinalEffort /* or any other expression to sum over*/);
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading