How to Sum all the values in multiple column index using LINQ

@Yoichi you are a genius, this worked perfectly, thank you so much for this, this is great.

Is there a way to only get the value, instead of an array? I guess could add (indexnumber) at the end of the array, like this: Enumerable.Range(dt.Columns.Count-5,5).Select(Function(i) dt.AsEnumerable.Take(dt.Rows.Count-1).Sum(Function(r) Double.Parse(r(i).ToString))).ToArray()(1)
But is there another way to get just the individual sum of the column and not an array?

1 Like