What does the following expression do?
subTotalAdditions.Select(Function(field) CDec(documentFields(field))).ToList.Sum() + subtotal
The expression does the following:
It uses the subTotalAdditions variable, which is a list of field names that represent the line amounts in the document.
It uses the Select method to apply a function to each element of the list. The function takes a field name as an argument and returns the value of the corresponding document field converted to a decimal number using the CDec function.
It uses the ToList method to convert the result of the Select method into a list of decimal numbers.
It uses the Sum method to calculate the sum of the elements in the list.
It adds the subtotal variable, which is another decimal number, to the sum.
The expression returns the total amount of the document, which is the sum of all the line amounts and the subtotal.
References:
[VB.NET - Sum Method]
Dustin
15 days agoMike
20 days agoTamekia
26 days agoDenae
1 month agoMicaela
1 month agoFrance
1 month agoWalker
2 months agoVeta
2 months agoJames
2 months agoQueenie
2 months agoNettie
2 months agoYvonne
2 months ago