I have a List<List<string>> called _DataCollection, where each of the nested lists has an equal number of values. Although in all lines, the values ββin the nested lists are lines consisting of alphanumeric characters, blank lines, or a currency value. for instance
_DataCollection[0] = {"tom", "abc", "$525.34", "$123"} _DataCollection[1] = {"dick", "xyz", "$100", "$234"} _DataCollection[2] = {"harry", "", "$250.01", "$40"} _DataCollection[2] = {"bob", "", "$250.01", ""}
I need to make a way to sum all the values ββfor each index in all nested lists and add this to the list:
newSumList[0] = "N/A" since "tom" + "dick" + "harry" + "bob" can't be aggregated. newSumList[1] = "N/A" since "abc" + "xyz" + "" + "" can't be aggregated. newSumList[2] = "1125.36" newSumList[3] = "397" even though the last value of the last nested list is "".
Basically, summarize all the numerical values ββin the nested lists for each index.
The only way I can think of is to repeat the iteration and keep the current amount, but I was wondering if I could do this using LINQ or something else.
source share