LINQ to sum IEnumerable of matches

Hello Comunity,

I Have a IEnumerable of matches (got from my regex pdf extraction) and I would like to sum each single match converting to int / double if necessary.

My current approach is iterating over each item but I would like to enhance using LINQ.

Any Idea How to do it?

I made a few attempts combining different internet approaches but failed miserably so far.

Thank you so much,

some details are not clear or unknown

Give a try at following

myTotal =
YourMatchesOutputVar.Sum(Function (m) CDbl(m.Value))


It worked!

I was missing .value in the end! Thank you so much!

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.