How to get sum of all Columns from Linq?

Hi Experts,

Hope you all are doing well.

I want to get total of all columns in a integer variable
image

Output

total (Of integer) = 275

I have attached excel for you refernce.
testFile.xlsx (8.0 KB)

Note: Please don’t suggest loop

Give a try on following

(From d in dtData.AsEnumerable
Let ps = d.ItemArray.Sum(Function (x) CInt(“0” & x.ToString.Trim)
Select ps).Sum(Function (s) s)

3 Likes

Thanks for the time :slightly_smiling_face:

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